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.

Suppose user goes to www.site.com/feeds. It must show www.site.com/Layouts/feeds.html, keeping the url intact. How to do that with .htaccess?

Failure

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.site\.com/feeds$ [NC]
RewriteRule ^(.*)$ http://www.site.com/Layouts/feeds.html [R=301,L]

404 with this?! [contacted my admin about this, second, maybe a system thing]

RewriteEngine On
RewriteRule ^/feeds$ index.html [P]
share|improve this question

2 Answers 2

up vote 1 down vote accepted

Since it's an htaccess file, the context path is stripped; remove the leading slashes.

RewriteRule ^feeds$ Layouts/feeds.html [L]
share|improve this answer

If you want to "keep the URL intact", then you're not issuing a redirect, by definition -- a redirect is an instruction to the web browser "please go request this other page".

Instead, what you want is the Proxy flag to your RewriteRule, something like:

RewriteRule ^/feeds$ http://www.site.com/Layout/Feeds.html [P]
share|improve this answer
1  
@womble [P] should just be for external proxying - doesn't work for internal. –  Shane Madden Mar 3 '12 at 23:59
1  
Also - good to see you, welcome back! –  Shane Madden Mar 4 '12 at 0:08
    
@hhh Have you gotten rid of that bad RewriteCond? What's the config look like now? –  Shane Madden Mar 4 '12 at 0:26

Your Answer

 
discard

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