.htaccess如果url在html页面中有两个以上的斜杠,则显示404错误
我已经从htaccess创建了html页面 像这样.htaccess如果url在html页面中有两个以上的斜杠,则显示404错误,.htaccess,.htaccess,我已经从htaccess创建了html页面 像这样 Options +FollowSymlinks RewriteEngine on RewriteRule ^([^/]*)/(.*\.html) process/?category=$1&link=$2 [L] 很好用 它重定向url www.site.com/software/page.html 到 如果url有两个以上的斜杠,我想显示404错误 比如说 www.site.com/software/page.html/page.
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([^/]*)/(.*\.html) process/?category=$1&link=$2 [L]
很好用
它重定向url
www.site.com/software/page.html
到
如果url有两个以上的斜杠,我想显示404错误
比如说
www.site.com/software/page.html/page.html
or
www.site.com/software/software/page.html
应该显示404错误,而不是像这样重定向
www.site.com/process/index.php?category=software&link=page.html/page.html
目前我正在用php做这件事,但我想在.htaccess中做,以便在第一次请求时给出404错误
请查看并建议执行此操作的任何方法
谢谢此代码应运行:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^[^/]*/[^/]*/ dhddhdhdhdhdh [L]
RewriteRule ^([^/]*)/(.*\.html) process/?category=$1&link=$2 [L]
但是,我的所有javascript和css现在都在.htaccess中被禁用了。我认为这个解决方案适用于所有页面类型,比如.js、.css等。我理解。所以我会修改我的答案来解决这个问题。你能回答我的这个问题吗
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^[^/]*/[^/]*/ dhddhdhdhdhdh [L]
RewriteRule ^([^/]*)/(.*\.html) process/?category=$1&link=$2 [L]