misi_uk
asked on
.htaccess redirect
Ive tried different varitions of the following code and have failed to get it working correctly.
Basically if someone types in http://www.mydomain.com/gifts/Art.html
I want it to direct to http://www.mydomain.com/gallerytest.php?cid=Art
Im not getting any code errors just 'page not found'
Now Ive tested http://www.mydomain.com/gallerytest.php?cid=Art and it works so its definatly not redirecting correctly
Basically if someone types in http://www.mydomain.com/gifts/Art.html
I want it to direct to http://www.mydomain.com/gallerytest.php?cid=Art
Im not getting any code errors just 'page not found'
Now Ive tested http://www.mydomain.com/gallerytest.php?cid=Art and it works so its definatly not redirecting correctly
RewriteCond %{HTTP_HOST} www.mydomain.com/gifts/([^/]+).html [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/gallerytest.php?cid=%1 [L]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
What do you mean with "it looks for a directory gifts so does not work'? This i got from your example.
Do you want all directories to be rewritten to gallerytest.php? Could you give me a few examples as to what URL's should be rewritten to what?
Do you want all directories to be rewritten to gallerytest.php? Could you give me a few examples as to what URL's should be rewritten to what?
ASKER
The rewrite base was already defined at the top of .htaccess
It didnt work however it was helpful and after some tweaking its now working thanks
I used the following in the end:
It didnt work however it was helpful and after some tweaking its now working thanks
I used the following in the end:
RewriteCond %{HTTP_HOST} ^www.mydomain.com
RewriteRule ^gifts\/(.*)\.html http://www.mydomain.com/gallerytest.php?cid=$1 [NC]
ASKER
thats still not working however.
That seem to look for the directory gifts so does not work.
Im new to .htaccess so Im out of my comfort zone with this. Ive tried so many variations and cant seem to get it working!