0
votes

I want to rewrite my site URL structure to a SEO friendly url using htaccess file. I want to rewrite this URL:

/Site/mysite/tags.php?tag=tag

to

/Site/mysite/tags/tag

This is my script:

Options +FollowSymLinks
RewriteEngine on
RewriteRule /tag/(.*)\.php tags.php?tag=$1

other commands such as DirectoryIndex working properly but my above code not.

i know this question asked before but i can not fix this problem. excuse me please! thanks.

2

2 Answers

0
votes

Your script would rewrite /tag/foo.php to tags.php?tag=foo. What you need is

RewriteRule ^/tag/(.*) /tags.php?tag=$1
0
votes

Try this code rather :

RewriteEngine on
RewriteRule ^Site/mysite/tag/(.*)$ /Site/mysite/tags.php?tag=$1