我.htaccess
在文件夹中有一个文件public_html
,因此我的目录如下所示:
public_html
= cgi-bin/
= images/
= other/
- index.html
- .htaccess
文件.htaccess
重新路由www.example.com
到example.com
。我从网上复制了以下代码,到目前为止它可以正常工作:
# Remove www from any URLs that have them:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
现在,如果有人访问www.example.com/other
或example.com/other
出现禁止example.com/other/
页面错误。我想将任何这些请求重新路由到:
example.com/other/sub/index.html
我如何扩展现有.htaccess
文件(或在子文件夹中创建新文件)来实现这一点?(注意无需屏蔽浏览器栏中的任何地址)
感谢任何解决方案和简要解释...