1

Here's what I've currently written in my .htaccess file:

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

So when a user requests http://mydomain.com/welcome, which is not defined in the .htaccess file, it will result in a "404 Not Found" page.

Instead, I'd like to redirect pages that aren't explicitly defined in the .htaccess to another script, and pass the original URL. I don't want to use ErrorDocuments here. How can I do this?

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 回答