Forum Moderators: phranque

Message Too Old, No Replies

google webmaster listing template directories

disable template directories in url

         

flapjack

11:39 am on May 9, 2011 (gmt 0)

10+ Year Member



Hi

For some reason in my google webmaster account I'm seeing 1000's of errors for urls similar to the following

[mysite.com...]

Visiting one of these urls lands you on the homepage.

(GreenTemplate & a are actual directories)

I'd like the urls to strip out the index.php, GreenTemplate & a to leave

[mysite.com...]

I've attempted to strip out the index.php,GreenTemplate & a below (please see the #) and although it removes index.php it doesn't remove the directories.

Webmaster tools is listing not found errors for

[mysite.com...]

it should be

[mysite.com...]

The categories are all lowercase, and there are no uppercase entries on the category pages so I don't know where it's picking that uppercase letter from. Could this be a problem with my cod below?

thanks

RewriteEngine on
Options +FollowSymlinks
RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /index\.php\?cat=([^\ ]*)\ HTTP/
RewriteRule ^index\.php$ [mysite.com...] [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?cat=([^\ ]*)&bpage=([^\ ]*)\ HTTP/
RewriteRule ^index\.php$ [mysite.com...] [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?bpage=([^\ ]*)&cat=([^\ ]*)\ HTTP/
RewriteRule ^index\.php$ [mysite.com...] [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /pets\.php\?petid=([^\ ]*)&petnamename=([^\ ]*)\ HTTP/
RewriteRule ^pets\.php$ [mysite.com...] [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /index\.php\ HTTP/
RewriteRule ^index\.php$ [mysite.com...] [R=301,L]

#RewriteCond %{THE_REQUEST} ^GET\s/index.php/(GreenTemplate/|a) [NC]
#RewriteRule ^index.php/(GreenTemplate/|a)(.*)$ /$1 [R=301,L,NC]

RewriteCond %{HTTP_HOST} ^mysite\.com [NC,OR]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /[^?]*\?\ HTTP/ [NC,OR]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /[^/]*\.html\?[^/]*\ HTTP/ [NC,OR]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\?[^/]*\ HTTP/ [NC,OR]
RewriteCond %{HTTP_HOST} ^123\.123\.123\.123
RewriteRule (.*) [mysite.com...] [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?loadpage=./includes/profile.php&view=true&userkey=([^\ ]*)\ HTTP/
RewriteRule ^index\.php$ [mysite.com.com...] [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?loadpage=./includes/login.php\ HTTP/
RewriteRule ^index\.php$ [mysite.com...] [R=301,L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\?loadpage=./includes/register.php\ HTTP/
RewriteRule ^index\.php$ [mysite.com...] [R=301,L]

RewriteRule ^login.html$ /index.php?loadpage=./includes/login.php [L]
RewriteRule ^register.html$ /index.php?loadpage=./includes/register.php [L]
RewriteRule ^pet-owners-([^/]*)\.html$ /index.php?loadpage=./includes/profile.php&view=true&userkey=$1 [L]
RewriteRule ^([0-9]+)-(.*)\.html$ pets.php?petid=$1&petname=$2
RewriteRule ^([^-]+)-pet-page([0-9]+)\.html$ index.php?cat=$1&bpage=$2 [L]

flapjack

3:40 pm on May 9, 2011 (gmt 0)

10+ Year Member



I've been tweaking this and I've come up with the following rules that seem to work

# changes mysite.com/index.php & index.php/ to mysite.com/

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /index\.php(|/)\ HTTP/
RewriteRule ^index\.php(|/)$ [mysite.com...] [R=301,L]

# changes mysite.com/index.php/GreenTemplate/a/234-freddytortoise.html to mysite.com/234-freddytortoise.html

RewriteCond %{THE_REQUEST} ^GET\s/index.php/GreenTemplate/a/ [NC]
RewriteRule ^index.php/GreenTemplate/a/(.*)$ /$1 [R=301,L,NC]

#changes mysite.com/index.php/234-freddytortoise.html to mysite.com/234-freddytortoise.html

RewriteCond %{THE_REQUEST} ^GET\s/index.php/ [NC]
RewriteRule ^index.php/(.*)$ /$1 [R=301,L,NC]