Re: Ceon URI Mapping v4.x
Quote:
Originally Posted by
lidlchris
... do i have to go into hundreds of products and categories in the zen admin and add the old URL?? ..
This way would ensure CEON URI Mapping has knowledge of the old URI and reduce the chance of 301 redirect chaining. You can directly add these using phpMyAdmin or use the Zen Cart admin. You still have to go through hundreds of URLs no matter which way you use.
Quote:
Originally Posted by
lidlchris
... for example "http://www.swordsofhonor.com/theater-swords.html?pg=2html=theater-swords"
is being redirected to "http://www.swordsofhonor.com/fantasyswords.html?pg=2html=theater-swords" when it should go to "http://www.swordsofhonor.com/fantasyswords.html"
here is the 301 redirect in the htaccess file
Code:
RedirectMatch 301 ^/theater-swords.* http://www.swordsofhonor.com/fantasyswords.html
is this fixable??
This is not an issue with CEON URI Mapping.
If you want to remove the "Query String" you need to use mod_rewrite instead of using mod_alias to issue the redirect. Keep in mind if you change the location in the Zen Cart admin in the future you will end up with chained 301 redirects.
If you must use a 301 in the .htaccess file... Only use ONE of the following rules (based upon your needs).
Code:
#Place before other CEON URI Mapping Rules (METHOD 1)
#This matches based upon only the URI ignoring the Query String
RewriteRule ^/theater-swords.html$ /fantasy-swords.html [R=301,L]
#Place before other CEON URI Mapping Rules (METHOD 2)
#This matches based upon the URI and the Query String
RewriteCond %{QUERY_STRING} ^pg=2html=theater-swords$
RewriteRule ^/theater-swords.html$ /fantasy-swords.html [R=301,L]
Re: Ceon URI Mapping v4.x
Quote:
Originally Posted by
lhungil
This way would ensure CEON URI Mapping has knowledge of the old URI and reduce the chance of 301 redirect chaining. You can directly add these using phpMyAdmin or use the Zen Cart admin. You still have to go through hundreds of URLs no matter which way you use.
turns out to be only about 25% of the redirects are for products/categories/pages that are on the current site - so 75% are for old pages, non-existant pages, and blog pages..
This is not an issue with CEON URI Mapping.
yes i think i stated that - it works great..
If you want to remove the "Query String" you need to use
mod_rewrite instead of using
mod_alias to issue the redirect. Keep in mind if you change the location in the Zen Cart admin in the future you will end up with chained 301 redirects.
If you must use a 301 in the .htaccess file... Only use ONE of the following rules (based upon your needs).
Code:
#Place before other CEON URI Mapping Rules (METHOD 1)
#This matches based upon only the URI ignoring the Query String
RewriteRule ^/theater-swords.html$ /fantasy-swords.html [R=301,L]
#Place before other CEON URI Mapping Rules (METHOD 2)
#This matches based upon the URI and the Query String
RewriteCond %{QUERY_STRING} ^pg=2html=theater-swords$
RewriteRule ^/theater-swords.html$ /fantasy-swords.html [R=301,L]
so with the 2nd method, i would have to know all of the query strings that i am trying to redirect for?? that option won't work.. and method one is the one i currently am using - somewhat - and that just carries the query string with it.. so then there is no other way to redirect to a static URL without carrying the query string - for the 75% of the urls i need to redirect?? unless, or course, i do a 1 for 1 redirect for all the URL's instead of trying to 'cheat' by lumping some together..
Re: Ceon URI Mapping v4.x
Quote:
Originally Posted by
lidlchris
so with the 2nd method, i would have to know all of the query strings that i am trying to redirect for?? that option won't work. ...
Depends on what you need to match. Thus why both examples were given.
Quote:
Originally Posted by
lidlchris
... and method one is the one i currently am using - somewhat - and that just carries the query string with it.. so then there is no other way to redirect to a static URL without carrying the query string - for the 75% of the urls i need to redirect?? ...
Apache mod_alias (your example) by default keeps the Query String.
Apache mod_rewrite (posted solution) by default drops the Query String. In the event mod_rewrite on your hosting provider is not by default dropping the Query String you can explicitly tell mod_rewrite to drop the Query String. This is documented in the Apache mod_rewrite documentation for RewriteRule and for RewriteRule Flags.
Re: Ceon URI Mapping v4.x
Quote:
Originally Posted by
lhungil
Depends on what you need to match. Thus why both examples were given.
Apache mod_alias (your example) by default keeps the Query String.
Apache mod_rewrite (posted solution) by default drops the Query String. In the event mod_rewrite on your hosting provider is not by default dropping the Query String you can explicitly tell mod_rewrite to drop the Query String. This is documented in the Apache mod_rewrite documentation for
RewriteRule and for
RewriteRule Flags.
i appreciate your help... still not getting anywhere and this is so d............m frustrating.. i went back to a simple 1 to 1 301 rewrite since i know all of the files that need to be rewritten and to where.. but NONE of it is working now.. i'm ready to blow up this computer.. here are a few examples NOT working:
RewriteRule ^/testimonials\.html$ index.php?main_page=page_2 [R=301,L]
RewriteRule ^/umarex$ http://www.swordsofhonor.com/?main_p...acturers_id=50 [R=301]
RewriteRule ^/united-cutlery$ http://www.swordsofhonor.com/?main_p...acturers_id=49 [R=301]
i placed ALL of these rewrites above the CEON coding in htacess...
Re: Ceon URI Mapping v4.x
A few things:
- The new location should be an absolute path. So either starts with "http://" or with "/".
- All RewriteRules with a flag of R should also use L to say "stop processing other rules and redirect now". So [R=301,L].
- If for some reason the server is not dropping the Query String, use the flag QSD. So [R=301,QSD,L].
- If one needs to keep the Query String, use the flag QSA. So [R=301,QSA,L].
- On some servers the leading "/" is stripped from the "match" portion before being passed to mod_rewrite, so one may need to omit the leading "/" in the "match".
As lidlchris noted the best place for these "manual" 301 redirects will be after the "RewriteEngine On" and before the other stuff added by CEON URI Mapping.
Code:
RewriteRule ^umarex$ http://www.swordsofhonor.com/?main_page=index&manufacturers_id=50 [R=301,L]
Re: Ceon URI Mapping v4.x
Quote:
Originally Posted by
lhungil
A few things:
- The new location should be an absolute path. So either starts with "http://" or with "/".
- All RewriteRules with a flag of R should also use L to say "stop processing other rules and redirect now". So [R=301,L].
- If for some reason the server is not dropping the Query String, use the flag QSD. So [R=301,QSD,L].
- If one needs to keep the Query String, use the flag QSA. So [R=301,QSA,L].
- On some servers the leading "/" is stripped from the "match" portion before being passed to mod_rewrite, so one may need to omit the leading "/" in the "match".
As lidlchris noted the best place for these "manual" 301 redirects will be after the "RewriteEngine On" and before the other stuff added by CEON URI Mapping.
Code:
RewriteRule ^umarex$ http://www.swordsofhonor.com/?main_page=index&manufacturers_id=50 [R=301,L]
adding the ,L in the parameters [R=301,L] made them all work.. :D BUT i still can't get the ones with query strings to drop the strings.. when i use QSD, my entire website gives an 'internal server error' and no pages can be brought up.. i remove the QSD and all is fine.. i've tried QSD in different positions of the parameters [QSD,R=301,L], [R=301,L,QSD].
Re: Ceon URI Mapping v4.x
Quote:
Originally Posted by
lidlchris
... i still can't get the ones with query strings to drop the strings..
Ahhh, your hosting provider is using Apache 2.2 (the QSD flag was added in Apache 2.4). Try the following to force Apache 2.2 to drop the Query String (it's a kludgy workaround - been awhile since I've used this):
Code:
RewriteRule ^theater-swords.html$ /fantasy-swords.html? [R=301,L]
Sorry I did not check your server version / remember this workaround earlier. Any of your RewriteRules which include a "?" such as the one for Umarex should already be dropping any extra query string components.
On a side note: If you ever use Google AdWords - make sure you change any ADs to use the new URLs as the old redirected URLs will discard the Google AdWords tracking code. Same goes for Campaign tracking via Google Analytics.
Re: Ceon URI Mapping v4.x
Quote:
Originally Posted by
lhungil
Ahhh, your hosting provider is using Apache 2.2 (the QSD flag was added in Apache 2.4). Try the following to force Apache 2.2 to drop the Query String (it's a kludgy workaround - been awhile since I've used this):
Code:
RewriteRule ^theater-swords.html$ /fantasy-swords.html? [R=301,L]
Sorry I did not check your server version / remember this workaround earlier. Any of your RewriteRules which include a "?" such as the one for Umarex should already be dropping any extra query string components.
On a side note: If you ever use Google AdWords - make sure you change any ADs to use the new URLs as the old redirected URLs will discard the Google AdWords tracking code. Same goes for Campaign tracking via Google Analytics.
wow - worked great... and thanks for the tip on adwords.. you've been a great help.. :smile:
Re: Ceon URI Mapping v4.x
Quote:
Originally Posted by
lidlchris
wow - worked great...
Glad we were able to get things working as desired! And thank you for letting us know it worked :smile:
Re: Ceon URI Mapping v4.x
Ok, I've solved the problem with the configure.php file. Am now up to rewriting. Where do I find the .htaccess file? :blush:
ETA - Please ignore. Apparently not enough caffeine today. :shocking: