Reputation: 7053
I am trying to execute this rule:
RewriteRule ^featured$ home.php?featurez=1 [L,NC,PT,R=301]
But what I get is:
http://apps.com/var/www/vhosts/apps.com/httpdocs/iphone/home.php?featurez=1
I tried to overcome it with PT tags...but nothing has an effect on it :(..whats the problem and how do I solve it..
Upvotes: 1
Views: 564
Reputation: 143886
When you leave off the leading slash in your rule's target, when apache needs to guess whether the path is a URI path or a file path, it guesses wrong. You can help apache out by either adding a leading slash (or making the target an absolute URI) or adding a rewrite base:
RewriteBase /iphone/
RewriteRule ^featured$ home.php?featurez=1 [L,NC,PT,R=301]
(or whatever the base URI is for your request)
Or change the target to an absolute URI:
RewriteRule ^featured$ /iphone/home.php?featurez=1 [L,NC,PT,R=301]
This is assuming your htaccess file is sitting in the directory "iphone" inside your document root, and to access the redirect you go to http://your.domain/iphone/featured
. Otherwise, just get rid of all the iphone/
stuff.
Upvotes: 0
Reputation: 4906
you can try this:
RewriteEngine on
RewriteRule ^featured$ home.php?featurez=1 [QSA,L,R=301]
Upvotes: 1
Reputation: 7888
RewriteRule ^featured$ http://%{HTTP_HOST}/home.php?featurez=1 [L,NC,PT,R=301]
Upvotes: 0