首页 > 解决方案 > 重定向到 htaccess 上的特定端口的规则

问题描述

如何指定将请求重定向到某个端口的规则?

这是我现有的.htaccess文件。

# Enable rewrite engine and route requests to framework
RewriteEngine On

# Some servers require you to specify the `RewriteBase` directive
# In such cases, it should be the path (relative to the document root)
# containing this .htaccess file
#
# RewriteBase /

RewriteCond %{REQUEST_URI} \.ini$
RewriteRule \.ini$ - [R=404]

RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L,QSA]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

默认情况下,它被重定向到 80。

我尝试在文件中添加以下行:

RewriteRule ^.*$ "http\:\/\/127\.0\.0\.1\:2222%{REQUEST_URI}" [P,QSA,L]

我很容易与 .htaccess 规则混淆。

很感谢任何形式的帮助。

标签: regexapache.htaccess

解决方案


推荐阅读