[Resolved] mod_rewrite issue
Posted: Tue Nov 03, 2009 9:30 pm
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
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