从我的网站删除或重定向错误的索引网址?

时间:2013-10-29 01:24:53

标签: regex wordpress apache .htaccess mod-rewrite

这与我的其他问题Spam and Old URLs ModificationFake URLs created automaticly的关系。 是否有人会告诉我他们为什么被创建?我希望重定向到网址下方。我想从我的域名中删除额外的字符串或垃圾邮件。我更喜欢.htaccess。我正在使用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

Document_root代码中的.htaccess代码如下所示。

<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 个答案:

答案 0 :(得分:1)

之前尝试其他几条规则和指令之前:

# 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]