[英]How to redirect htaccess to specific URL
I have a website that home page is in site.pt/pt/home
so I need to put in .htaccess
but I don't know how... 我有一个网站主页位于
site.pt/pt/home
的网站,因此我需要输入.htaccess
但我不知道如何...
I have this code: 我有以下代码:
<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}]
How can I do that? 我怎样才能做到这一点?
Thank you. 谢谢。
Try putting this just after RewriteEngine On
: 尝试将它放在
RewriteEngine On
:
RewriteCond %{REQUEST_URI} !^/pt/home [NC]
RewriteCond %{REQUEST_URI} !^/pt/home/.* [NC]
RewriteRule ^(.*)$ /pt/home/$1 [R=301,L]
The two conditions are for skipping request that start already with /pt/home
and the rule redirect all other requests there. 这两个条件是跳过已经以
/pt/home
开始的请求,并且该规则将所有其他请求重定向到该位置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.