Clean Urls with mod_rewrite

十年热恋 提交于 2020-01-17 01:34:27

问题


How do I make it so when a user clicks on, http://localhost/jobwehave.co.za/job/1

They are shown the page for http://localhost/jobwehave.co.za/job?=1

But the url still says http://localhost/jobwehave.co.za/job/1

I am using mod_rewrite in an .htaccess file at the root of the site.


回答1:


Try this,

RewriteRule ^jobwehave.co.za/job/(\d+)$ jobwehave.co.za/job?id=$1

Rick.




回答2:


RewriteEngine On
RewriteRule /jobwehave.co.za/job/([0-9]+)$ /jobwehave.co.za/job?job=$1 [L,QSA]


来源:https://stackoverflow.com/questions/5301583/clean-urls-with-mod-rewrite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!