SEO url help

Discuss practical ways rearrange URLs using mod_rewrite.

SEO url help

Postby manokiss » Tue Aug 05, 2008 10:01 am

Hi,

Im trying to convert my site url to a seo one but at the same time to avoid any duplicated content i need the seo converted one do work.

Currently i have the following to redirect everything to www.

Also i need rewrite each link:

Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]


My current format is:
http://www.domain.com/index.php?centro= ... boutus.php

need to be

http://www.domain.com/about-us


Also do the last slash effect in seo as duplicated, i mean:

http://www.domain.com/about-us or http://www.domain.com/about-us/

could generate a duplicated at google? how to avoid it?


Thank you in advance!
manokiss
 
Posts: 11
Joined: Fri May 18, 2007 8:14 pm

Postby richardk » Wed Aug 06, 2008 3:28 pm

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

# Redirect /index.php?centro=includes/aboutus.php to /aboutus.
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{QUERY_STIRNG} ^(.*&)?centro=includes/([^&]+)\.php(&.*)?$ [NC]
RewriteRule ^(index\.php)?$ http://www.example.com/%2? [R=301,L]

# Remove trailing slashes (/aboutus/ to /aboutus).
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.+)/$ http://www.example.com/$1 [R=301,L]

# Force www.
RewriteCond %{HTTP_HOST} ^(example\.com)$ [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

# Rewrite /aboutus to /index.php?centro=includes/aboutus.php
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*[^/])$ /index.php?centro=includes/$1.php [QSA,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby manokiss » Wed Aug 06, 2008 5:43 pm

Thanx!

but this one is not happening, the other rules are working ok:

# Redirect /index.php?centro=includes/aboutus.php to /aboutus.
manokiss
 
Posts: 11
Joined: Fri May 18, 2007 8:14 pm

Postby richardk » Thu Aug 07, 2008 12:48 pm

QUERY_STIRNG should be QUERY_STRING.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby manokiss » Thu Aug 07, 2008 3:08 pm

ahh...thank you very much!
manokiss
 
Posts: 11
Joined: Fri May 18, 2007 8:14 pm


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 84 guests

cron