Jump to content

modrewrite question


tatjana

Recommended Posts

Hello all,

Compliments for the great forum. Although its my first post it has helped me a lot in the past!

I have a little problem here.
These are some of my dynamic urls:
[a href=\"http://www.mysite/companysearch/search_result.php?search=Browse&category=painter\" target=\"_blank\"]http://www.mysite/companysearch/search_res...ategory=painter[/a]
[a href=\"http://www.mysite/companysearch/search_result.php?search=Browse&category=builder\" target=\"_blank\"]http://www.mysite/companysearch/search_res...ategory=builder[/a]


Thats not excactly the urls search engines like!

I would love to change it into:
[a href=\"http://www.mysite/companysearch/painter.html\" target=\"_blank\"]http://www.mysite/companysearch/painter.html[/a]
[a href=\"http://www.mysite/companysearch/builder.html\" target=\"_blank\"]http://www.mysite/companysearch/builder.html[/a]

Can somebody help me on this one?
Thnx Tatjana
Link to comment
https://forums.phpfreaks.com/topic/5205-modrewrite-question/
Share on other sites

[!--quoteo(post=356078:date=Mar 17 2006, 08:13 PM:name=Spixxx)--][div class=\'quotetop\']QUOTE(Spixxx @ Mar 17 2006, 08:13 PM) [snapback]356078[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Mind re-writting your question? I don't quite understand...
[/quote]


Aslong as you are using an Apache webserver with mod_rewrite installed - do this.

In your companysearch dir create a .htaccess file with this inside :

RewriteEngine On
RewriteRule ^(.*).html [a href=\"http://www.mysite/companysearch/search_result.php?search=Browse&category=$1\" target=\"_blank\"]http://www.mysite/companysearch/search_res...ategory=$1[/a]



that will make anything type in the (.*) space of the url to be a searchable category EG /painter.html will be rewritten to /search_result.php?search=Browse&category=painter
etc

let me know if you dont get me lol
Link to comment
https://forums.phpfreaks.com/topic/5205-modrewrite-question/#findComment-18574
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.