重定向URL首页有圆点 [英] Redirect url to home page with trailing dots
问题描述
谷歌网站管理员显示一些重复的URL, 他们是
www.abc.com/index.php?option=com_toys&view=detail&n_id=148&ite ..
www.abc.com/index.php?option=com_toys&view=detail&n_id=156&item ..
www.abc.com/index.php?option=com_games&view=detail&vid=170&itemid ..
www.abc.com/index.php?option=com_play&view=detail&vid=175&it ..
要删除它们 - 我觉得最好的办法就是重定向到主页包含任何网址 .. 在网址的结尾
试图把这个条件,但它不工作太
重写规则^(。*)\。HTM $ http://www.abc.com/$1 [R = 301,L]
重写规则^(。*)$ http://www.abc.com/$1 [L,R = 301]
重写规则^(。*)\。HTM $ http://www.abc.com/$1 [R = 301,L]
正确的URL结构
www.abc.com/index.php?option=com_toys&view=detail&n_id=148&Itemid=2
www.abc.com/index.php?option=com_toys&view=detail&n_id=156&Itemid=2
www.abc.com/index.php?option=com_games&view=detail&vid=170&Itemid=3
www.abc.com/index.php?option=com_play&view=detail&vid=175&Itemid=4
任何建议,请...多日Thnx
修改于9月13日 您好Anubhav,
如果我们有这些重定向URL以404页则低于命令htaccess的正确
的RewriteCond%{THE_REQUEST} \?。+?\。\。
重写规则^指数\ .PHP $ - [NC,L,R = 404]
到的httpd.conf
启用了mod_rewrite和.htaccess,然后把这个code在< $ C C>的.htaccess $ DOCUMENT_ROOT
目录下:
选项+了FollowSymLinks -MultiViews
#开启mod_rewrite的上
RewriteEngine叙述上
的RewriteBase /
的RewriteCond%\?。+?\ {THE_REQUEST} \。
重写规则^ /? [R = 301,L,NE]
Google webmaster showing some duplicate url, They are
www.abc.com/index.php?option=com_toys&view=detail&n_id=148&ite..
www.abc.com/index.php?option=com_toys&view=detail&n_id=156&item..
www.abc.com/index.php?option=com_games&view=detail&vid=170&itemid..
www.abc.com/index.php?option=com_play&view=detail&vid=175&it..
To remove them - i feel the best way is to redirect to home page for any url containing .. at end of url
tried putting this condition, but it does not work too
RewriteRule ^(.*)\.htm$ http://www.abc.com/$1 [R=301,L]
RewriteRule ^(.*)$ http://www.abc.com/$1 [L,R=301]
RewriteRule ^(..*)\.htm$ http://www.abc.com/$1 [R=301,L]
Correct url structure are
www.abc.com/index.php?option=com_toys&view=detail&n_id=148&Itemid=2
www.abc.com/index.php?option=com_toys&view=detail&n_id=156&Itemid=2
www.abc.com/index.php?option=com_games&view=detail&vid=170&Itemid=3
www.abc.com/index.php?option=com_play&view=detail&vid=175&Itemid=4
any suggestions pls ... many thnx
Edit on 13th Sep Hello Anubhav,
If we have redirect these URL to 404 page then is below command in htaccess correct
RewriteCond %{THE_REQUEST} \?.+?\.\.
RewriteRule ^index\.php$ - [NC,L,R=404]
Enable mod_rewrite and .htaccess through httpd.conf
and then put this code in your .htaccess
under DOCUMENT_ROOT
directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} \?.+?\.\.
RewriteRule ^ /? [R=301,L,NE]
这篇关于重定向URL首页有圆点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!