views:

52

answers:

3

I want to use mod-rewrite for just one file instance:

www.domain.com/contact

to pull from www.domain.com/contact.php

I used a rewrite rule for all files that look like a directory to do this initially but it messed up some diretory redirects I created so in the short-term, I'd rather just do it for a specific file.

Thanks.

A: 

I would go to something like that:

RewriteRule ^/contact.php$ url_to_redirect/contact.php [P,QSA]

And just in case you have more available information here.

Artem Barger
This will not do what the OP asked. She doesn't want to redirect across domains.
Sean Bright
A: 
RewriteEngine On

# make sure http://domain.com redirects to http://www.domain.com
RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

# redirect from /contact to /contact.php
RewriteRule ^contact$ /contact.php [R=301,L]
slosd
+1  A: 

Try this rule:

RewriteRule ^contact$ contact.php [L]

This will redirect requests of the URL path /contact internally to /contact.php. If you don’t want to use this rule in a .htaccess file, prepend the pattern with a /^/contact$.

Gumbo