【问题标题】:Rewrite URLs using .htaccess to a subfolder使用 .htaccess 将 URL 重写到子文件夹
【发布时间】:2023-03-26 11:46:01
【问题描述】:

我的问题是我将整个网站移到了 public-html 的子文件夹中。尝试重写 URLS 以通过 .htaccess 自动添加子文件夹但没有成功 这是代码:

ErrorDocument 401 "Unauthorized"
ErrorDocument 403 "Forbidden"
RewriteEngine On
RewriteBase /
DirectoryIndex index.php index.cgi index.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ anb/$1 [L,QSA]

提前致谢

【问题讨论】:

标签: apache .htaccess mod-rewrite url-rewriting


【解决方案1】:

我通过删除该行来让它工作

RewriteBase / 

显然,当 .htaccess 放在根目录 A.K.A [public_html] 中时,RewriteBase 无法正常工作

【讨论】:

    猜你喜欢
    • 2011-03-02
    • 2011-10-07
    • 1970-01-01
    • 2015-04-22
    • 2011-08-05
    • 2014-02-28
    • 2012-12-12
    • 2012-08-20
    • 2014-03-20
    相关资源
    最近更新 更多