【发布时间】:2015-12-05 16:13:32
【问题描述】:
我的 htaccess:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^m/(.*)$ /$1 [R=301,NC,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteRule products-([0-9]+).html$ products.php?page=$1 [NC]
RewriteRule services-([\-]?[0-9]+)-(.+).html$ services.php?id=$1 [NC]
RewriteRule objects-([\-]?[0-9]+)-(.+).html$ object.php?id=$1 [NC]
Wordpress 行
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
我有一个错误。
如果有人尝试域 .com/product-6-orange.html/something
他获得了与域 .com/product-6-orange.html 相同的页面
我不希望该域 .com/product-6-orange.html/something 返回正确答案。
我想要那个 domain .com/product-6-orange.html/something 重定向到 domain .com/product-6-orange.html
所以 .html 之后的任何内容都需要删除。
但是如何??
【问题讨论】:
标签: html regex .htaccess mod-rewrite