虚荣 URL、.htaccess 问题
我试图将虚荣网址添加到我的网页,但它不起作用。 到目前为止,我已经尝试过
RewriteRule ^([A-Za-z0-9]+)[^.]$ index.php?page=$1 [nc]
and
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 的 url 重定向到 index.php?page = $1 但页面变量现在必须是“vanityurl”。
我在本地主机和我的网络服务器上尝试过这个,但我得到了同样的错误!
谢谢你!为您解答! :)
Im trying to add vanity url to my web page, but its not working.
So far I have tried with
RewriteRule ^([A-Za-z0-9]+)[^.]$ index.php?page=$1 [nc]
and
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^(.*)$ index.php?page=$1 [NC]
but its not working, and i dont know .htaccess syntax!
All I got is this error:
Internal Server Error
The server encountered an internal
error or misconfiguration and was
unable to complete your request.Please contact the server
administrator, admin@localhost and
inform them of the time the error
occurred, and anything you might have
done that may have caused the error.More information about this error may
be available in the server error log.
Do you know how can I do this?
How can I make.htaccess to redirect my url which looks like www.page.com/vanityurl to index.php?page = $1 but page variable must now be "vanityurl".
I tried this on localhost and on my web server but i get the same error!
Thank you! For your answer! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
检查
error_log
以了解发生了什么情况。可能是您的
httpd.conf
未设置为允许在.htaccess
中指定重写规则。如果是这种情况,您将在错误日志中看到一条消息例如:
为了在
.htaccess
中使用重写规则,AllowOverride
设置需要包含FileInfo
或设置为All
代码> 例如Check the
error_log
to find out what is going on.It might be that your
httpd.conf
is not set to allow rewrite rules to be specified in.htaccess
If that is the case then you will see a message in the error log like:
In order to use rewrite rules in
.htaccess
theAllowOverride
setting needs to either includeFileInfo
or be set toAll
e.g