虚荣URL,.htaccess问题

时间:2010-11-11 13:04:58

标签: .htaccess

我试图将虚荣网址添加到我的网页,但它无法正常工作。 到目前为止,我已尝试过

RewriteRule ^([A-Za-z0-9]+)[^.]$ index.php?page=$1 [nc]

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^(.*)$ index.php?page=$1 [NC]

但它不起作用,我不知道.htaccess语法!

我得到的只是这个错误:

  

内部服务器错误   服务器遇到内部问题   错误或错误配置,是   无法完成您的请求。

     

请与服务器联系   管理员,admin @ localhost和   告诉他们错误的时间   发生了,你可能有任何东西   完成可能导致错误。

     

有关此错误的详细信息可能有效   在服务器错误日志中可用。

你知道我怎么能这样做? 我如何make.htaccess将我的网址www.page.com/vanityurl重定向到index.php?page = $ 1,但页面变量现在必须是“vanityurl”。

我在localhost和我的网络服务器上试过这个但是我得到了同样的错误!

谢谢!为了你的答案! :)

1 个答案:

答案 0 :(得分:0)

检查error_log以了解发生了什么。

可能是您的httpd.conf未设置为允许在.htaccess

中指定重写规则

如果是这种情况,那么您将在错误日志中看到如下消息:

RewriteEngine not allowed here

要在.htaccess中使用重写规则,AllowOverride设置需要包含FileInfo或设置为All,例如

AllowOverride FileInfo