2012-03-28 22 views
0

我有一个简单的RewriteRule,它在我的本地机器上工作正常,但当我上传到我的活服务器时,它不起作用。mod-rewrite不能在活服务器上工作

错误:

Not Found The requested URL /redirect:/jobs.php/1/field-engineer.php/1/field-engineer.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

的.htaccess:

Options +FollowSymlinks 
RewriteEngine on 
RewriteRule ^(.*)\.htm $1.php [NC] 
RewriteRule jobs/([0-9]+)/(.*)/ jobs.php?id=$1 [NC] 
RewriteRule testimonial-details/([0-9]+)/(.*)/ testimonial-details.php?id=$1 [NC] 
RewriteRule testimonials/([0-9]+)/(.*)/ testimonials.php?id=$1 [NC] 

任何帮助将欣然赞赏。

回答

-1

您是否检查过您的重写模块是否已加载? 顺便说一句,你应该看看在你的htaccess:

<IfModule mod_rewrite.c> 
// your rewrite stuff here 
</IfModule> 

编辑:

也许这将有助于。尝试将PT标志设置为你的第一个重写规则

RewriteRule ^(.*)\.htm $1.php [NC,PT]

这将告诉引擎就生成的URL干净的第二条路径。因为根据你的规则有一个奇怪的行为。

的URL

jobs/1/civil-engineer.html被改写为jobs/1/civil-engineer.php

,但下面的规则

jobs/([0-9]+)/(.*)/等待一个URL像jobs/1/civil-engineer.php/

我做了一些测试,但去掉 '/'只避免了某些错误,但行为仍然很奇怪。我发现的唯一途径是增加了PT标志或更改规则

RewriteRule jobs/([0-9]+)/(.*)\?php jobs.php?id=$1

+0

是,它的工作现场的服务器上。 RewriteRule褒奖/([0-9] +)/(。*)/ testimonials.php?id = $ 1 [NC] ...但其他两个不是。谢谢 – xmox 2012-03-28 23:57:54

+0

被重写为'/ redirect:/ jobs.php/1/field-engineer.php/1/field-engineer.php'的链接是什么? – grifos 2012-03-29 00:01:40

+0

localhost/jobs/1/civil-engineer.html和代码 - > $ jobs_url = WEBSITE_URL。 '工作/' 。 $ row-> job_id。 '/'。 $ helper-> format_url_keyword($ row-> position)。 '的.html'; – xmox 2012-03-29 00:05:21

相关问题