Jump to content

301 redirects, canonical URL not working with the theme


Robindall

Recommended Posts

I'm have a problem with 1.5.6.2, my old urls are all indexed with good rankings, i tried a 301 redirect from the server, but that just puts through to a /page-not-found, the redirects also shows on the .htaccess file.


 


When i spoke to my hosting company they say 


 some of the other lines in your .htaccess file are interfering with this redirect. 


 


so i assume that the .htaccess file is the root problem? how can i resolve the problem with the .htaccess file? do i need the server redirects?


 


any help would be appreciated


Link to comment
Share on other sites


Yes Robindall. Its a .htaccess file issue.

 

As a configuration file, .htaccess is very powerful. Even the slightest syntax error (like a missing space) can result in your content not displaying correctly or at all.

 

First create an empty text file using a text editor such as notepad, and save it as htaccess.txt.

Next edit the contents of the file. Check the following examples:

 

# This allows you to redirect your entire website to any other domain

Redirect 301 / http://mt-example.com/

 

Link to comment
Share on other sites

  • 1 month later...

can you show an example of your 301 rewrite rule?

 

Sure Vekia, Below I explained about 301 redirects with example:

Examples

Here are some basic 301 redirect examples via the .htaccess text file (please create or upload this file in the folder you want to perform the redirect from).

 

For example placing the .htaccess file into the /www.domain.com/web/content/ folder (via FTP), will perform the redirect when a visitor goes to http://www.domain.com in their Web Browser.

 

Redirect a single page:

Redirect 301 /pagename.php http://www.domain.com/pagename.html

 

Redirect an entire site:

Redirect 301 / http://www.domain.com/

 

Redirect an entire site to a sub folder

Redirect 301 / http://www.domain.com/subfolder/

 

Redirect a sub folder to another site

Redirect 301 /subfolder http://www.domain.com/

 

You can also redirect based on file extensions via the following syntax:

RedirectMatch 301 (.*)\.html$ http://www.domain.com$1.php

This will redirect any file with the .html extension to use the same filename but use the .php extension instead.

Rewrite examples

You can also perform 301 redirects using rewriting via .htaccess.

 

Here are four examples:

 

#Redirect from old domain to new domain

RewriteEngine on

RewriteBase /

RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]#Redirect to www location

RewriteEngine on

RewriteBase /

RewriteCond %{HTTP_HOST} ^domain.com [NC]

RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,NC]#Redirect to www location with subdirectory

 

RewriteEngine on

RewriteBase /

RewriteCond %{HTTP_HOST} domain.com [NC]

RewriteRule ^(.*)$ http://www.domain.com/directory/index.html [R=301,NC]# Redirect from www to non-www location

 

RewriteEngine on

RewriteBase /

RewriteCond %{HTTP_HOST} ^www.domain.com [NC]

RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

 

Below is a tool that will check your redirect to ensure that it is indeed search engine friendly: http://www.webconfs.com/redirect-check.php

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...