Nortski Posted December 25, 2013 Share Posted December 25, 2013 Hi all, When I do a 301 redirect check using the free tool at http://www.ragepank.com/redirect-check/, it shows that my index page, and all variants of it, are 302 redirected. How do I change this situation so they are all 301 redirecting to my desired URL eg http://www.mysite.co.uk/ I would normally add RewriteEngine onRewriteCond %{HTTP_HOST} !^www\.mysite\.co\.ukRewriteRule (.*) http://www.mysite.co.uk/$1 [R=301,L] to the .htaccess file, but the current one has no references to any 302 redirects. This begs the question, how and where are the 302's coming from? Thanks in advance. Nortski. Link to comment Share on other sites More sharing options...
Syd Posted December 29, 2013 Share Posted December 29, 2013 Hi, I have a similar problem using the rangepank tool. I also changed the htaccess file but rangepank shows me the following, but my selected domain is with www: http://www.asianexoticdream.com returns a 302 (temporary) redirect http://asianexoticdream.com returns a 301 (permanent) redirect http://www.asianexoticdream.com/index.php returns a 302 (temporary) redirect http://asianexoticdream.com/index.php returns a 301 (permanent) redirect http://www.asianexoticdream.com/index.htm returns a 302 (temporary) redirect http://asianexoticdream.com/index.htm returns a 301 (permanent) redirect http://www.asianexoticdream.com/index.html returns a 302 (temporary) redirect http://asianexoticdream.com/index.html returns a 301 (permanent) redirect http://www.asianexoticdream.com/index.shtml returns a 302 (temporary) redirect http://asianexoticdream.com/index.shtml returns a 301 (permanent) redirect http://www.asianexoticdream.com/index.asp returns a 302 (temporary) redirect http://asianexoticdream.com/index.asp returns a 301 (permanent) redirect http://www.asianexoticdream.com/default.asp returns a 302 (temporary) redirect http://asianexoticdream.com/default.asp returns a 301 (permanent) redirect http://www.asianexoticdream.com/default.aspx returns a 302 (temporary) redirect http://asianexoticdream.com/default.aspx returns a 301 (permanent) redirect http://www.asianexoticdream.com/index.aspx returns a 302 (temporary) redirect http://asianexoticdream.com/index.aspx returns a 301 (permanent) redirect http://www.asianexoticdream.com/index.cfm returns a 302 (temporary) redirect http://asianexoticdream.com/index.cfm returns a 301 (permanent) redirect http://www.asianexoticdream.com/index.pl returns a 302 (temporary) redirect http://asianexoticdream.com/index.pl returns a 301 (permanent) redirect http://www.asianexoticdream.com/default.htm returns a 302 (temporary) redirect http://asianexoticdream.com/default.htm returns a 301 (permanent) redirect Link to comment Share on other sites More sharing options...
SWN Posted January 6, 2014 Share Posted January 6, 2014 I think this is the problem I'm having as well. The base url of the shop I'm working on is www.(domain).com/ and works fines. However, when accessing the site using just (domain).com/, a 302 temporary redirect is performed to www.(domain).com/ I want this to be a 301 permanent redirect instead. Does anyone know how to make it so? Link to comment Share on other sites More sharing options...
Syd Posted January 6, 2014 Share Posted January 6, 2014 Hi friends, I have found the solution for my problem in another site, I hope this could help you. I wrote this: RewriteCond %{HTTP_HOST} !^(.*)\.asianexoticdream\.com$ [NC]RewriteRule ^(.*)$ http://www.asianexoticdream.com/$1 [R=301,L] Just change asianexoticdream, and write your domain. After this, I used again the tool: http://www.ragepank.com/redirect-check/ and it returned 301 for www and without www. I hope it could be useful for you. Link to comment Share on other sites More sharing options...
NuDreamer Posted March 27, 2014 Share Posted March 27, 2014 Thanks for that snippet Syd. It worked perfectly for me. For anyone else who wants to use it, just be sure you have in your SEO and URLs section in your back office, your site must be set to use the www. version of your domain in order for the above code to work properly. it will NOT work without the www. set. Link to comment Share on other sites More sharing options...
sophia76 Posted March 27, 2014 Share Posted March 27, 2014 I think the proper course of action here would be to steer clear of locking anyone into one method or the other and instead simply modify the current hooks code for setting the different http status flags so that each redirect can be set with it's own status. It will default to 302 like it should, but you will have the option to add 301 using the hooks in a custom module as an extra argument to the already existing hook arguments. This would still keep the module lightweight as adding such a feature will only take a couple lines. BTW, the reasoning for using 302 by default is that it's usually best practice to leave permanent changes to a site that is not yours, up to the owner. Since this is not a database change, they could not easily revert 301 to a 302 if it should happen to get spidered with a 301 that happened to cause problems. It's easier to revert from a 302 than it is a 301 and that is the reason why most redirects default to 302 unless otherwise specified as such. It's almost like making a change to an entire website without first making a backup. It might work, but then again it might not. You'll always want to have the option to revert back if something goes wrong and that is what 302 designed for. Link to comment Share on other sites More sharing options...
nakecorp2 Posted July 6, 2015 Share Posted July 6, 2015 (edited) Also, in your .htaccess file you'll want to add your site's IP address. Obviously replace the "yourwebsite" part with your site and replace the IP 111.111.111.111 with your sites IP. Place this above the line "#~~start~~ Do not remove this comment..........." . RewriteEngine on # ## NON WWW REDIRECTION TO WWWRewriteCond %{HTTP_HOST} ^yourwebsite.com$RewriteRule ^(.*)$ "http\:\/\/www\.yourwebsite\.com\/$1" [R=301,L]### IP REDIRECTION TO WWWRewriteCond %{HTTP_HOST} ^111\.111\.111\.111RewriteRule (.*) http://www.yourwebsite.com/$1 [R=301,L]## # ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again Edited July 6, 2015 by nakecorp2 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now