htaccess的URL重写 - 请求的URL在服务器上未找到重写、未找到、器上、htaccess

由网友(抓住夏天)分享简介:具有将URL重写运行的问题,但服务器将不显示内容。我的.htaccess文件是Having an issue where the URL rewrite is running but the server will not display the contents. My .htaccess file isRewr...

具有将URL重写运行的问题,但服务器将不显示内容。我的.htaccess文件是

Having an issue where the URL rewrite is running but the server will not display the contents. My .htaccess file is

    RewriteEngine On
    RewriteBase /
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /project.php [NC]
    RewriteCond %{QUERY_STRING} id=([0-9]+) [NC]
    RewriteRule . project-%1.html? [R=301]

感谢您的帮助!

Thanks for your help!

编辑:对不起,这里是一些更多的信息

Sorry, here is some more info!

我想重写

    www.siteurl.co.uk/project.php?id=82

    www.siteurl.co.uk/project-82.html

在code在的.htaccess重写URL完美,但页面不显示。我收到了

The code in the .htaccess rewrites the URL perfectly but the page does not display. I get a

    404 The requested URL /project-82.html was not found on this server. 

我希望帮助!

I hope that helps!

推荐答案

您只需要一半的解决方案,创造了pretty的网址。现在缺少的是另一半,送pretty的URL来进行处理的应用程序,如下

You only have one half of the solution, creating the pretty urls. What is missing is the other half, sending the pretty urls to an application for processing as below

RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /project.php [NC]
RewriteCond %{QUERY_STRING} id=([0-9]+) [NC]
RewriteRule . project-%1.html? [R=301]

#you need this rule to process your www.siteurl.co.uk/project-82.html request
RewriteRule ^project-([0-9]+).html$ project.php?id=$1 [L,NC,QSA]
阅读全文

相关推荐

最新文章