redirect with string parameter to new folder
6 posts
• Page 1 of 1
- universal4
- Posts: 11
- Joined: 17 Aug 2015, 21:04
redirect with string parameter to new folder
I am not sure I have titled this thread correctly, but obviously the mods can edit the title if they feel it is needed.
Ok here is what I need to do
old url
http://domain.com/folder/page.php?string
new url
http://domain.com/go/string.php
I have gone round and round with this after reading a number of examples here in the forums, given up and came back to try another day and the best I have been able to come up with is
RewriteRule ^/folder/?page\.php$ http://domain.com/go/%1\.php [L,R=301]
which provides new url
http://domain.com/?string.php
There are 2 problems with that, it isn't in the sub-folder needed and it contains the "?"
I am 100% positive I have some bad syntax but not sure where I am screwing this up.
I do have the standard rules for wordpress to fix permalinks in place but have also tried the same thing on html sites and get the same kinds of results.
Ok here is what I need to do
old url
http://domain.com/folder/page.php?string
new url
http://domain.com/go/string.php
I have gone round and round with this after reading a number of examples here in the forums, given up and came back to try another day and the best I have been able to come up with is
RewriteRule ^/folder/?page\.php$ http://domain.com/go/%1\.php [L,R=301]
which provides new url
http://domain.com/?string.php
There are 2 problems with that, it isn't in the sub-folder needed and it contains the "?"
I am 100% positive I have some bad syntax but not sure where I am screwing this up.
I do have the standard rules for wordpress to fix permalinks in place but have also tried the same thing on html sites and get the same kinds of results.
- universal4
- Posts: 11
- Joined: 17 Aug 2015, 21:04
Re: redirect with string parameter to new folder
Ooops, I think the string I posted was the wrong one but one of the many I tested.
I just tested it again and this rule DOES produces the results I posted above
RewriteRule ^/folder/?page\.php$ http://domain.com/go/%1/.php [L,R=301]
which provides new url
http://domain.com/?string.php
I just tested it again and this rule DOES produces the results I posted above
RewriteRule ^/folder/?page\.php$ http://domain.com/go/%1/.php [L,R=301]
which provides new url
http://domain.com/?string.php
Re: redirect with string parameter to new folder
Hello.
Please try this:
RewriteEngine On
RewriteCond %{QUERY_STRING} (.*)
RewriteRule ^folder/page\.php$ /go/%1.php [NC, R=301]
Please try this:
RewriteEngine On
RewriteCond %{QUERY_STRING} (.*)
RewriteRule ^folder/page\.php$ /go/%1.php [NC, R=301]
- universal4
- Posts: 11
- Joined: 17 Aug 2015, 21:04
Re: redirect with string parameter to new folder
I do believe that did the trick.
I need to test this a little further after clear cache etc since first test worked but second failed and third test in different browser worked. (the fail is most likely a dirty cache)
I gotta say, The support here is just top notch all the way, and like support taught me a while back, any testing requires the use of additional browsers as well as cache clearing before you make up you mind whether something is working or not...
I need to test this a little further after clear cache etc since first test worked but second failed and third test in different browser worked. (the fail is most likely a dirty cache)
I gotta say, The support here is just top notch all the way, and like support taught me a while back, any testing requires the use of additional browsers as well as cache clearing before you make up you mind whether something is working or not...
- universal4
- Posts: 11
- Joined: 17 Aug 2015, 21:04
Re: redirect with string parameter to new folder
Happy to report the code provided by Yaroslav does work perfectly, the reason my second test failed was due to not clearing cache, I have tested this with many different parameters from different machines running different OS's and different browsers and they all work just fine.
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 17 guests