# $Id: .htaccess 9977 2013-03-19 20:51:56Z john $
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/$
RewriteRule (.*) main.html [L,QSA]
# Get rid of index.php
RewriteCond %{REQUEST_URI} /index\.php
RewriteRule (.*) index.php?rewrite=2 [L,QSA]
# Rewrite all directory-looking urls
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*) index.php?rewrite=1 [L,QSA]
# Try to route missing files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} public\/ [OR]
RewriteCond %{REQUEST_FILENAME} \.(jpg|gif|png|ico|flv|htm|html|php|css|js)$
RewriteRule . - [L]
# If the file doesn't exist, rewrite to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?rewrite=1 [L,QSA]
</IfModule>
# sends requests /index.php/path/to/module/ to "index.php"
# AcceptPathInfo On
# @todo This may not be effective in some cases
FileETag Size
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript
</IfModule>
但问题是第一次它工作得很好,如果我输入www.example.com/我被重定向到www.example.com/main.html 如果我输入www.example.com/login/,我被重定向到登录页面 但是如果登录被认证并且得到签名,则会出现问题,因为我被重定向到www.example.com,因为我再次被重定向到example.com/main.html我不会被重新定向到www.example.com想要这个时间。 请建议我如何解决这个问题的解决方案。 谢谢, 问候
答案 0 :(得分:0)
请尝试以下规则:
RewriteRule ^$ main.html [L,QSA]
它只会重定向根URL。