问题
This is with the relation of my other questions Spam and Old URLs Modification and Fake URLs created automaticly. Would any body tell me that why they are being created? and I want to redirect below urls. i want to remove extra string or spam from my domain name. i would prefer .htaccess. I am using wordpress.
deemasfashion.com/ **cgi-sys/defaultwebpage.cgi**
deemasfashion.com/ page/38/wpmp_switcher
deemasfashion.com/ ?2fou_com
deemasfashion.com/ **?iapolo_com**
deemasfashion.com/ ?dur=2016
deemasfashion.com/ **?dur=375**
deemasfashion.com/ ?file
deemasfashion.com/ ?option=com_content&view=frontpage&itemid=1
deemasfashion.com/ ?option=com_content&view=category&id=34:latest-tech- news&itemid=60
deemasfashion.com/ ?www.web3389.com
deemasfashion.com/ ?wpmp_switcher=desktop
deemasfashion.com/ ?option=com_content&view=category&id=34%3Alatest-tech-news&Itemid=60
My .htaccess code in Document_root code is as follows.
<IfModule mod_rewrite.c>
RewriteEngine On
# code by anubhava
RewriteCond %{QUERY_STRING} ^.+$
RewriteRule ^(page/[0-9]+/?).*$ /$1? [L,NC,R=301]
# Remove Edit Post
# RewriteCond %{QUERY_STRING} (?:^|&)post=([^&]+) [NC]
# RewriteRule ^wp-admin/post\.php$ /?p=%1 [L,NC,R=301]
# function.session-start not working
# RewriteRule ^(latest-pakistani-anarkali-pishwas-frock-wear/[^/]+/?).+$ /$1? [L,NC,R=301]
# code by anubhava
# BEGIN WordPress
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} ^www\.deemasfashion\.com$
RewriteRule ^deemasfashion\.com/?(.*)$ http://deemasfashion.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/
RewriteRule ^index\.html$ http://deemasfashion.com/ [R=301,L]
RewriteRule ^index\.htm$ http://deemasfashion.com/ [R=301,L]
# END WordPress
</IfModule>
回答1:
Try couple of these rules and directives at before any other rule:
# forward 404 to home page
ErrorDocument 404 /
RewriteEngine On
RewriteRule ^(page/[0-9]+)/.+$ /$1? [L,NC,R=301]
RewriteCond %{QUERY_STRING} ^option=.+$ [NC,OR]
RewriteCond %{QUERY_STRING} ^[^=]+$
RewriteRule ^$ /? [L,NC,R=301]
来源:https://stackoverflow.com/questions/19648075/remove-or-redirect-wrong-indexed-urls-from-my-website