这段代码真的让我很困惑为什么会这样。如果我添加 [R=302,L] 那么我的链接可以完美地工作,就像我希望的那样。但是如果我不添加它并且我只有 [L] 它会进入错误页面。R和no R的区别不就是浏览器的地址栏有没有更新吗?
这是代码的最后一行。我正在尝试进行内部/静默 mod_rewrite
我想要用户输入http://example.com还是http://example.com/home/
我想在内部使用相同的网址http://example.com/home
# Do not remove this line, otherwise mod_rewrite rules will stop working
RewriteBase /
AddHandler application/x-httpd-php .css
AddHandler application/x-httpd-php .js
Options +Multiviews
RewriteEngine On
#NC not case sensitive
#L last rule don't process futher
#R 301 changes the url to what you want
#changes the host to make sure it has no www infront
RewriteCond %{HTTP_HOST} !^example\.host56\.com
RewriteRule ^(.*)$ http://example.host56.com [R=302,L]
#kills request with file extensions
RewriteCond %{THE_REQUEST} \.(php|jsp|html|jsp|asp)/?\ HTTP/
RewriteRule .* - [F]
#selects home
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /\ HTTP/1.1$
RewriteRule ^.*$ home/ [L]