很长时间以来我都在尝试定义重写规则,但是我还不能成功?我有一个简单的页面 www.myURL/pdf.php?id= 2 .我想通过以下方式使其友好: www.myURL/pdf/2/ ...
Long time I am trying to define Rewriting rules but I could not succeed yet? I have a simple page www.myURL/pdf.php?id=2. I want to make it friendly by this: www.myURL/pdf/2/ ...
我在Google上度过了一段时间后写下了以下规则:
I wrote this rule after spending time on google:
Options +FollowSymlinks RewriteEngine On RewriteRule ^pdf/([0-9]+)\$ pdf.php?id=$1.当我在服务器上上传.htaccess文件并尝试先运行时,它给我500错误.第二次加载页面,但无法显示友好的URL;它像以前一样显示. 请告诉我更好的解决方案,我遵循了许多说明使其变得有用,但未能成功.除非我向他显示友好的URL,否则我的客户不会走的更远.请尽快帮助我.这是我的客户端托管组织:Justhost.
When I uploaded my .htaccess file on server and try to run first it give me 500 ERROR. Second time it loaded page but it could not show me friendly URL; it was showing as before. Kindly tell me better solution, I followed many instructions to make it useful but could not successful. My Client are not going further unless I showed him friendly URL. kindly help me as soon as possible. This is my client hosting Organization: Justhost.
推荐答案您可以使用Apache的重写引擎来做到这一点.像这样:
You can do this using Apache's Rewrite Engine. Something like this:
RewriteEngine On RewriteRule ^pdf/([0-9/]+)$ /pdf.php?id=$1 [L]这将使您可以转到 yoursite/pdf/192 而不是 yoursite/pdf.php?id=192
This will allow you to go to yoursite/pdf/192 instead of yoursite/pdf.php?id=192
更多推荐
如何使用.htaccess定义友好的URL规则?
发布评论