我有一个页面,其URL如下:
https://example.net:9000/something
我希望能够从这里访问它https://example.net/mysite
并屏蔽URL,以便在最后一个/
我这样试过:
重写规则^:9000/某些内容/?$ /mysite/
但是没有用,为什么?
此外,我在htaccess上还有一些其他规则必须保持不变:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(jpeg|jpg|gif|png)$ /public/404.php [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L] <---everything up to this point has to stay the same
RewriteRule ^:9000/something/?$ /mysite/
</IfModule>
- 谢谢-谢谢
1条答案
按热度按时间zpgglvta1#
https:/example.net/
和https://example.net:9000
有两个独立的http主机,它们之间没有任何关系,所以实际上需要https:/example.net/
的服务器来代理要转发到https://example.net:9000
的请求。假设
https:/example.net/
由apache http服务器提供服务(取决于您提出问题的方式),那么使用apache代理模块应该可以实现这一点,可以直接使用:ProxyRequests off
,则确实是ProxyRequests off
,而不是on
。如果您仅有权访问 dsitributed 配置文件(.“htaccess”),则保留该行)*...或通过重写模块:
显然,代理模块和proxy_http模块必须加载到http服务器中。该规则必须在为
https:/example.net/
服务的http主机的配置中实现。如果您没有访问权限,可以在该主机的DOCUMENT_ROOT
中的 distributed 配置文件(通常称为.“htaccess”)中实现。