Apache的URL重写将无法正常工作 [英] Apache Url Rewriting won't work

查看:234
本文介绍了Apache的URL重写将无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在httpd.conf文件我有的AllowOverride FileInfo的。在我的网络服务器与所有其他文件的顶级.htaccess文件,我有这样的:

In the httpd.conf file I have AllowOverride FileInfo. In the .htaccess file in top level of my webserver with all the other files, I have this:

RewriteEngine On
RewriteRule ^downloads/?$ index.php?page=downloads [L,NC]

但它不工作。 mywebsite /下载和mywebsite /下载/总能给一个404没有找到。知道为什么吗?谢谢。 (mywebsite /的index.php?页=下载的确实的工作)。

而我每一次我改变它每次重新启动Apache的。

And I'm restarting apache every time I change it.

而当我把code以上在httpd.conf,该网站甚至不会加载所有,只是空白,永远纺轮的Safari

And when I put the code above in httpd.conf, the website won't even load at all, just blank, spinning safari wheel forever.

它的罚款,如果我只是做 RewriteEngine叙述在,但如果我做任何事情(的RewriteBase,重写规则),Web浏览器支出年龄试图加载并最终给这个错误

Its fine if I just do RewriteEngine On, but if I do anything else (RewriteBase, RewriteRule), the web browser spend ages trying to load and finally giving this error:

Safari无法打开网页 http://mk12.gotdns.com/ ,因为服务器里本页面位于没有响应。

Safari can’t open the page "http://mk12.gotdns.com/" because the server where this page is located isn’t responding.

任何人有任何的想法有什么不对?

Anyone have any idea what's wrong?

编辑:?我能够做,例如,禁止与重写css文件,和它的作品,但是,从下载任何进入规则index.php页面=下载使服务器无法响应(见上文)不要紧什么网页,网站将不加载在所有。任何想法..?

I'm able to make, for example, css files forbidden with rewrite, and it works, but any rule that goes from downloads to index.php?page=downloads makes the server not respond (see above), it doesn't matter what page, the website won't load at all. Any ideas..?

推荐答案

它的工作!我把code在错误的地方。这是在httpd.conf,但最后。将它变成<名录及GT;其良好的。感谢您的帮助!

It Worked!! I was putting the code in the wrong spot. It was in httpd.conf, but at the end. Move it into <Directory> and its good. Thanks for your help!

编辑:另外,我发现,如果标志都是这样它不会工作: [L,NC] 。它必须是 [L,NC] (无空格)。

Also, I found that It won't work if the flags are like this: [L, NC]. It has to be [L,NC] (no spaces).

所以,这两个问题在哪里,这是不是里面&LT;目录/库/ Web服务器/文件&gt;和有标志之间的空格。希望这会帮助别人,将来别人。

So the two problems where that it wasn't inside <Directory "/Library/WebServer/Documents">, and there were spaces between the flags. Hopefully this will help someone else in the future.

这篇关于Apache的URL重写将无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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