Need help with a automatic rewrite

New to mod_rewrite? This is a good place to start.

Need help with a automatic rewrite

Postby 0ni » Sat Apr 25, 2009 1:30 am

I have a tags system on some software that I develop, it uses the following method.

User types a tag into a box and submits, and you can view the tag at .com/tags.php?tag=example

How do I make it so it will be .com/tags/example.html ?
0ni
 
Posts: 2
Joined: Fri Apr 24, 2009 5:23 am

Postby richardk » Sat Apr 25, 2009 5:39 am

Try the following in a .htaccess file in your document root
Code: Select all
Options +FollowSymLinks -MultiViews

RewriteEngine On

RewriteRule ^tags/([^/]+)\.html$ /tags.php?tag=$1 [QSA,L]

You will also have to edit your script to output these new URLs.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby 0ni » Sat Apr 25, 2009 9:19 am

ok thanks, I will try and post back the results
0ni
 
Posts: 2
Joined: Fri Apr 24, 2009 5:23 am


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 6 guests

cron