Page 1 of 1

[Resolved] mod_rewrite issue

Posted: Tue Nov 03, 2009 9:30 pm
by FireNetStudios
So, I'm having a mod_rewrite issue.

I started with the code provided by the CMS MS documentation.

---------------------------------------------------
Options -Indexes
ServerSignature Off

Options +FollowSymLinks


RewriteEngine on

#Sub-dir e.g: /cmsms
RewriteBase /

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# but ignore POST requests.

RewriteCond %{REQUEST_URI} !/$
RewriteCond %{REQUEST_URI} !\.
RewriteCond %{REQUEST_METHOD} !POST$
RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]


# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]



---------------------------------------------------

Then, I added code to remove www. and instances of the index file.

---------------------------------------------------
#301 Redirect eliminates www. prefix
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domina.com/$1 [R=301,L]

#Stops index.html and index.php from showing up
RewriteCond %{THE_REQUEST} ^.*\/index\.html?
RewriteRule ^(.*)index\.html?$ http://domain.com/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^.*\/index\.php?
RewriteRule ^(.*)index\.php?$ http://domain.com/$1 [R=301,L]
---------------------------------------------------

My problem is that I still seem to have duplicate content.  While navigating the site, the URLs are .com/content.html or .com/category/content.html.  That's great.

However, I can call duplicate pages by entering .com/?page=content or .com/index.php/?page=content.  The index.php will disappear but the ?page=content part stays.  

Is there a way to prevent ?page=content from showing and only show content.html

Re: mod_rewrite issue

Posted: Tue Nov 03, 2009 10:01 pm
by calguy1000
This is NOT a duplicate content issue.

Just because a page can be addressed numerous ways, doesn't mean that the search engines will consider it duplicate content...(unless you've done silly things like submit your URL to google THEN implement pretty URLS).... search engines CRAWL sites... they don't guess URLS.

Re: mod_rewrite issue

Posted: Wed Nov 04, 2009 1:50 am
by Jeff
Nope, there will always be multiple ways to enter a URL for a page, but that doesn't matter for SEO as long as the URLs created in your site are the same then it is good for SEO.

Re: mod_rewrite issue

Posted: Wed Nov 04, 2009 2:13 pm
by FireNetStudios
Awesome!  Thanks, guys! (and or gals!)

I was beginning to get a bit frustrated.  I got the .htaccess to strip the query string but then all the pages returned 404.  Which makes sense if it won't let the browser access that page.  lol

Thanks again!