【发布时间】:2023-03-11 03:41:01
【问题描述】:
我在本地服务器上运行相同的应用程序 - 一个在“localhost”中,另一个在“localhost/bss/”中。我的域端口转发给他们。所以 www.domain.com:1111 和 sub.domain2.info:1111 指向 localhost。现在他们都显示本地主机。我需要将 sub.domain2.info:1111 (localhost) 重定向到 sub.domain2.com:1111/bss/ (localhost/bss) 但不想看到'/bss'
我在 localhost 中的 .htaccess 目前是这样的 -
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
Options -Indexes
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)sub.domain2.info:1111$
RewriteRule (.*) /bss/$1 [R=301,L]
localhost/bss 中的 .htaccess 没什么特别的 -
RewriteEngine On
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
Options -Indexes
非常感谢您的回复。尝试了一些,但似乎没有任何效果!
【问题讨论】:
标签: php .htaccess server url-redirection