Friday, September 22, 2017
how to make redirect in .htaccess for url with specific symbols
The problem was to redirect wrong CodeIgniter url with %C2%A0 symbols to another pahe in .htaccess
For example
http://mysite.com/some-page%C2%A0
to
http://mysite.com/other-page
Redirect 301 /some-page%C2%A0 /other-page does not work
Here I had found some solution:
RewriteCond %{THE_REQUEST} ^[A-Z]+\ /[^%?\ ]*\%
RewriteRule ^. http://www.example.com/ [R=301,L]
This rule redirects all matches with %.. symbols
So I had tried next:
RewriteCond %{THE_REQUEST} some-page[^%?\ ]*\%
RewriteRule ^. /other-page [R=301,L]
But after testing, it adds to now url an old url as parameters
As the results I had something like this:
http://mysite.com/index.php/other-page?/some-page/&... etc
So, after some googling I have found this
So I had changed
RewriteRule ^. /other-page [R=301,L]
to
RewriteRule .? /other-page$1? [R=301,L]
So, to make 301 redirect from broken url with % symbols need to do something like this:
RewriteCond %{THE_REQUEST} some-page[^%?\ ]*\%
RewriteRule .? /other-page$1? [R=301,L]
Subscribe to:
Post Comments (Atom)
Restore xampp database from backup
steps: stop mysql xampp 1 - create some backup folder "data_1" 2 - from your current xampp/mysql/data folder move core folders an...
-
Here is original source that worked for me https://stackoverflow.com/questions/57128891/how-repair-corrupt-xampp-mysql-user-table (1) Fi...
-
jquery focusout does not works in chrome and safari for checkbox and radio elements. example: <input type='checkbox' name=...
-
source from https://magento.stackexchange.com/questions/251926/magento-2-3-its-not-working-properly-in-localhost https://github.com/magen...
No comments:
Post a Comment