【问题标题】:unable to change url with .htaccess in godaddy hosting无法在 godaddy 托管中使用 .htaccess 更改 url
【发布时间】:2012-07-15 20:20:25
【问题描述】:

我必须用 .htaccess 更改网址

.htaccess 存储在链接文件夹中。

我的 .htaccess 文件是

Options -Multiviews
Options +FollowSymlinks
RewriteEngine on
RewriteRule   ^([1-9a-z]*)$ index.php\?u=$1 [L]

当我打开这个

'http://example.com/link/index.php?u=3ujkzf'

网址它的工作原理。

但是当我打开时

'http://example.com/link/3ujkzf'短链接

我得到了默认的 Godaddy 托管错误页面。

请帮忙..

感谢您的阅读..

【问题讨论】:

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


    【解决方案1】:

    如果您的项目位于link 文件夹中,则需要包括:

    RewriteRule   ^link/([1-9a-z]*)$ /link/index.php?u=$1 [L]
    

    顺便说一句,重写规则第二部分的问号不用转义

    【讨论】:

    • 我的 .htaccess 文件在链接文件夹中,但我必须将重写规则更改为你的.. ??
    • @Aashu Abhee 在这种情况下,您可以尝试在RewriteEngine On 之后使用RewriteBase /link/
    【解决方案2】:

    尝试添加 RewriteBase /

    就在 RewiteEngine On 下方

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-06-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多