Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is it possible to have an erroneous URL remain in the address bar while redirecting the user to a URL within my domain? I want www.domain.com/forum to be the actual site being served in all 404 circumstances but I don't want the referring URL to be rewritten (other than the domain portion, which is being done on the registrar level).

This is my current .htaccess

RewriteEngine On

RedirectMatch permanent ^/$ http://www.domain.com/forum/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* http://www.domain.com/forum/ [L,R]
share|improve this question
    
Do you actually mean an ErrorDocument directive? –  Alvin Wong Sep 2 '12 at 3:47

1 Answer 1

You want to send 404 errors up to your application? Easy enough. You need to specify an existing file, though. For example:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /forum/index.php [L]
share|improve this answer
    
Doesn't that accomplish the same thing, as far as the URL bar is concerned? –  Knocks X Sep 2 '12 at 4:04
    
@KnocksX It's not sending a redirect response, which is what changes the URL bar. –  Shane Madden Sep 2 '12 at 4:20
    
That is seriously amazing. Thank you so much. –  Knocks X Sep 2 '12 at 4:26
    
I think I spoke too soon. This breaks the previous rule and the www is not always added anymore. The forum also loses all formatting and is loaded without css. –  Knocks X Sep 2 '12 at 5:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.