I've recently changed my URLs with parameters to more readable URLs with the following .htaccess:
RewriteRule ^page/([A-Za-z0-9-+_\s]+)$ /index.php?n=$1 [L]
RewriteRule ^category/([A-Za-z0-9-+_\s]+)/([0-9]+)$ /index.php?p=$1&b=$2 [L]
I believe this poses problems now with duplicate content on the search engines, as index.php
URLs and domain.com/page/
URLs will both be indexed.
If calls made to domain.com/page/1
get redirected to index.php?n=1
how can I redirect requests made to index.php
to domain.com/page/
?
My attempt to do so is giving me a 404 code sending me to domain2.
#RewriteCond %{QUERY_STRING} ^n=([A-Za-z0-9]+)$ [NC]
#RewriteRule ^index\.php$ http://domain.com/page/? [R=301,L]
.htaccess:
IndexIgnore *
ErrorDocument 404 http://domain2.com
#REDIRECTS
Redirect 301 /keyword.php http://domain.com
Redirect 301 /inc/keyword.php http://domain.com
Options +FollowSymlinks
RewriteEngine on
#Redirect all pages in a folder to a single URL
RewriteRule ^test/(.*)$ http://domain.com [L,R=301]
# HTTP HOST, escape . and start string with ^
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,NC]
RewriteCond %{QUERY_STRING} ^p=h&m=([A-Za-z]+)&y=([0-9]+)$ [NC]
RewriteRule ^index\.php$ http://domain.com? [R=301,L]
#RewriteCond %{QUERY_STRING} ^n=([A-Za-z0-9]+)$ [NC]
#RewriteRule ^index\.php$ http://domain.com/page/? [R=301,L]
RewriteRule ^page/([A-Za-z0-9-+_\s]+)$ /index.php?n=$1 [L]
RewriteRule ^category/([A-Za-z0-9-+_\s]+)/([0-9]+)$ /index.php?p=$1&b=$2 [L]