1

これが私が現在私の.htaccessファイルに書いているものです:

RewriteEngine on
RewriteRule ^contact contact.php 
RewriteRule ^browse browse.php 
RewriteRule ^contact/ contact.php 
RewriteRule ^privacy privacy-policy.php
RewriteRule ^signup register.php
RewriteRule ^register register.php

そのため、ファイルで定義されていないhttp://mydomain.com/welcomeをユーザーがリクエストする.htaccessと、「404 Not Found」ページが表示されます。

.htaccess代わりに、明示的に定義されていないページを別のスクリプトにリダイレクトし、元の URL を渡したいと考えています。ここでは sを使用したくありませんErrorDocument。これどうやってするの?

4

1 に答える 1

1
RewriteEngine on

RewriteRule ^contact contact.php 
RewriteRule ^browse browse.php 
# why is contact the only one with a slash at the end?
RewriteRule ^contact/ contact.php 
RewriteRule ^privacy privacy-policy.php
RewriteRule ^signup register.php
RewriteRule ^register register.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /other.php [L]
于 2012-05-03T14:28:18.753 に答える