Welcome to WebmasterWorld Guest from 54.226.146.15

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Canonical redirect issue

     

Jon12345

3:45 pm on Oct 23, 2013 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I understand that with Google, you need to get the canonical redirect working correctly, else you might lose PR.

When you go to my homepage, if you type mysite.com, it goes to www.mysite.com. But if you go to mysite.com/forums/, it stays there, rather than redirecting to www.mysite.com/forums/.

How can I get it to go to www.mysite.com/forums/ ?

My htaccess code is:

# Externally redirect only direct client requests for /index.php to /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index.(html?|php)\ HTTP/
RewriteRule ^(([^/]+/)*)index.(html?|php)$ http://www.example.co.uk/$1 [R=301,L]
#
# Externally redirect to canonicalize the domain name if a non-canonical
# hostname is requested, in order to prevent duplicate-content problems
RewriteCond %{HTTP_HOST} !^(www\.example\.co.uk)?$
RewriteRule (.*) http://www.example.co.uk/$1 [R=301,L]

[edited by: aakk9999 at 3:56 pm (utc) on Oct 23, 2013]
[edit reason] Examplified domain in .htaccess code [/edit]

g1smd

5:01 pm on Oct 23, 2013 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



When placed in the root htaccess file, that code should do what you want.

Check to see if there is another htacess file in the /forums/ folder. That may be the problem.

There's three places where a literal period needs to be escaped.

Jon12345

8:22 am on Oct 24, 2013 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I just checked and there is an htaccess file in the forums folder. Here it is:

AcceptPathInfo On

RewriteEngine On
RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]


xcache.var_size = 3M
xcache.var_count = 2
xcache.var_slots = 8K
xcache.var_ttl = 7200
xcache.var_maxttl = 14400
xcache.var_gc_interval = 300


What should I do?

g1smd

12:50 pm on Oct 24, 2013 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Move all that stuff to the root htaccess file.

Adjust the Regex pattern to match the requested URLs and the rule target for the actual script location.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month