mod_rewrite的与GoDaddy托管 [英] mod_rewrite with GoDaddy hosting

查看:265
本文介绍了mod_rewrite的与GoDaddy托管的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好了,我真的不知道很多关于mod_rewrite的,我期待在apache的文档,仍然没有搞清楚了这一点。

Ok, so I really don't know much about mod_rewrite and I'm looking over the apache docs and still not figuring this out.

下面是我的htaccess的(这是大多只是复制和;从一个网站,我发现贴):
在的.htaccess基地DIR:

Here is my htaccess (which is mostly just copy & pasted from a site I found):
.htaccess in base dir:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule    ^$    public/    [L]
    RewriteRule    (.*) public/$1    [L]
 </IfModule>

的.htaccess中/公共目录:

.htaccess in /public dir:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

</IfModule>

基本上我用我目前的测试服务器上的上述htaccess的文件,它的伟大工程,完全像我期望(一切都被无缝地重定向到公共目录)。

Basically I'm using the above htaccess files on my current test server and it works great and exactly like I would expect (everything gets seamlessly redirected to public dir).

现在,当我把这个在我的GoDaddy的托管帐户,我得到内部服务器Errror。我做了一些搜索和我相当肯定我应该能够使用mod_rewrite与GoDaddy。

Now when I throw this on my GoDaddy hosting account i get "Internal Server Errror". I've done some searching and I'm fairly certain I should be able to use mod_rewrite with GoDaddy.

我怀疑这是因为我没有使用的基本目录主办的网站在该网站是在文件夹中的HTML / MyApp的/(其中HTML是基本目录),我有一个子域设立在GoDaddy的查看该文件夹中。

I suspect this is because I'm not using the base directory to host the site in. The site is in in the folder html/myapp/ (where html is the base directory) and i have a subdomain set up in GoDaddy to look in that folder.

编辑:

检查我看到这个错误日志之后 -

After checking the error logs I see this-

[Wed Apr 21 17:59:45 2010] [error] [client] mod_rewrite: maximum number of internal redirects reached. Assuming configuration error. Use 'RewriteOptions MaxRedirects' to increase the limit if neccessary.

所以,我认为我已经创建了某种形式的无限循环?但我不知道如何...

So I assume I've created some sort of infinite loop? But I'm not sure how...

推荐答案

好吧,我得到它的工作。继承人我做了什么:

Ok I got it working. heres what I did:

在根目录下的.htaccess:

for the .htaccess in the root directory:

<IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule    ^$    /public/    [L]
    RewriteRule    (.*) /public/$1    [L]
</IfModule>

和一个在/市民:

and for the one in /public:

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ /public/index.php?url=$1 [PT,L]

</IfModule>

我真的不知道为什么这个工程,但它确实。感谢所有帮助。

I'm honestly not sure why this works, but it does. Thanks to all that helped.

这篇关于mod_rewrite的与GoDaddy托管的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆