开发者

Using mod_rewrite to put words in the URL instead of category IDs

I'm working on a Business Directory Website. What I'd like to do is transform the URL String of : http://www.website.co.uk/business/results.php?category_id=11

To http://www.website.co.uk/business/Financial & Legal

How do I achieve this? Not too sure on the Rewrite Rules etc I am to use.

Thanks for any help, in advance.

I am now trying jut a开发者_C百科 test on a local host.

The HTML Code is as follows :

<h1>This is the PHP file.</h1>
<a href="index.php?url=category">Link Here</a>

So all I want is the URL to be http://localhost/mod_rewrite/index.php/category rather than : http://localhost/mod_rewrite/index.php?url=category

The .htaccess file is as follows (But doesnt appear to work)??

RewriteEngine on

RewriteRule ^([^/\.]+)/?$ /index.php?url=$1 [L]


Well,

in general you don't use ampersands in URLs. They will be replaced by "%26" when you try to call them as a link.

But a general approach towards your question could look like that:

RewriteEngine on
RewriteRule ^business/Financial.*?Legal$ results.php?category_id=11 [L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜