phranque

msg:3820123 | 10:56 am on Jan 6, 2009 (gmt 0) |
it depends on exactly what you are trying to do and what results you got from which request. if this is in .htaccess context, then you are using the local url-path, so the leading (directory) slash is stripped. also, if you are redirecting you should specify a fully qualified url and/or add an [R] flag. this might work: RewriteCond %{QUERY_STRING} ^id=(.*)$ RewriteRule ^folder/page.php?id=(.*)$ http://www.example.com/folder/newlandingpage.php?id=$1 [R=301,L]
|
3Mice

msg:3820156 | 12:28 pm on Jan 6, 2009 (gmt 0) |
Thanks for the reply...i am also trying to achieve a 301 redirect in the process for the search engine does [R=301,L] cover this?
|
phranque

msg:3820180 | 1:14 pm on Jan 6, 2009 (gmt 0) |
yes, but you should be curious enough to read the relevant parts of this document very carefully so you understand exactly what you are getting with that code: mod_rewrite - Apache HTTP Server [httpd.apache.org]
|
tomda

msg:3820189 | 1:26 pm on Jan 6, 2009 (gmt 0) |
Hi 3Mice, If not sure, just do a test locally. Then, once it is OK locally, just upload your .htaccess online. Also, do not forget to update your XML sitemap as well as playing with the URL removal request and doing other stuff on the Google Webmaster Tools. Personnal note: bas, imetosha :)
|
3Mice

msg:3820212 | 2:12 pm on Jan 6, 2009 (gmt 0) |
This one has worked RewriteCond %{QUERY_STRING} ^id=(.+) RewriteRule ^folder/page.php$ [mysite.com...] [QSA,L,R=301]
|
phranque

msg:3820723 | 3:40 am on Jan 7, 2009 (gmt 0) |
RewriteCond %{QUERY_STRING} ^id=(.*)$ RewriteRule ^folder/page.php?id=(.*)$ http://www.example.com/folder/newlandingpage.php?id=$1 [R=301,L] |
| sorry - i forgot when i wrote the above rule that the pattern doesn't match the query string in the RewriteRule. as you noticed you can use the QSA flag to reuse the old query string. if you had needed to use part of the old query string you could have done it thusly: RewriteCond %{QUERY_STRING} ^id=(.+)$ RewriteRule ^folder/page.php$ http://www.example.com/folder/newlandingpage.php?newidparam=%1 [R=301,L] |
|
|
|