Forum Moderators: phranque
I am trying to permanently redirect this:
[mysite.com...]
...to:
[mysite.com...]
I tried this:
Redirect 301 ^/headline.cfm http:/mysite.com/
Now, when I go to:
[mysite.com...]
...it redirects me to this:
[mysite.com...]
I do not want the query string on the end. I just want it to go to my homepage.
I tried this:
Redirect 301 ^/headline.cfm?id=57 http:/mysite.com/
... but that didn't even redirect me.
Can anyone help?
If you are using mod_rewrite, you will need to use a condition to account for a specific query string:
RewriteCond %{QUERY_STRING} ^id=57$
RewriteRule ^headline\.cfm$ /index.html? [R=301,L]
or
RewriteCond %{THE_REQUEST} ^headline\.cfm\?id=57$
RewriteRule ^headline\.cfm$ /index.html? [R=301,L]
You may or may not need the trailing '?' on the rule, it actually appends a blank query string, so nothing is automatically transferred from the original request.
Hope this helps.
Justin
RewriteCond %{THE_REQUEST} ^headline\.cfm\?id=57$
RewriteRule ^headline\.cfm$ /index.html? [R=301,L]
GET /headline.cfm?id=57 HTTP/1.1
RewriteCond %{THE_REQUEST} /headline\.cfm\?id=57
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /headline\.cfm\?id=57\ HTTP/
You may also need to preced the code with:
Options +FollowSymLinks
RewriteEngine on
Jim