我有一个主页位于site.pt/pt/home
的网站,所以我需要输入.htaccess
,但我不知道如何......
我有这段代码:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
我该怎么做?
谢谢。
答案 0 :(得分:0)
尝试在RewriteEngine On
之后放置它:
RewriteCond %{REQUEST_URI} !^/pt/home [NC]
RewriteCond %{REQUEST_URI} !^/pt/home/.* [NC]
RewriteRule ^(.*)$ /pt/home/$1 [R=301,L]
这两个条件是跳过已经/pt/home
启动的请求,并且该规则会重定向所有其他请求。