Can anyone advise me on the htaccess for doing this?
Thanks
g1smd
8:39 pm on Mar 22, 2011 (gmt 0)
There's tens of thousands of threads in this forum with similar code. What have you tried so far?
DaveQ
9:51 am on Mar 23, 2011 (gmt 0)
Sorry, I have tried searching for similar examples on this forum but without success.
Here's what I have so far in .htaccess:
Options +FollowSymlinks RewriteEngine On RewriteRule ^(.+)\.html$ /redirect.php?source=$1 [NC,R=301]
This has the outcome of redirecting: mydomain.com/test/news12.html to: mydomain.com/redirect.php?source=news12
but I want it to redirect to: mydomain.com/redirect.php?source=test/news12.html
so basically I'm missing the .html and the folder. What am I doing wrong?
Thanks
jdMorgan
11:27 pm on Mar 28, 2011 (gmt 0)
Move the code to root -- it must be above the "/test" directory if you wish the rule to be able to "see" the /test part of the path. Also Include the ".html" in the parentheses if you wish to capture it.
Options +FollowSymlinks RewriteEngine On # RewriteRule ^(test/.+\.html)$ /redirect.php?source=$1 [NC,R=301,L]