In my php page i have given link as href="test.php?category="xyz".
In url I want this page link to appear as "test/xyz".
In my .htaccess file i have added
RewriteRule ^test/([a-zA-Z]+) test.php?category=$
but this does'nt work for me.
All the other links in test.php gets test appended to their links.
eg. if there was example.php its appears as test/example.php
Help is appreciated.
Thanks in advance
Maybe this code can help you
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^test/([a-zA-Z]+)$ test.php?category=$1
</IfModule>
Try to access these urls : test.php?category=abc
and test/abc
. If two pages show the same content this code successful.
To learn more, please read the reference here
This sounds more like you forgot the use full relative paths in your links. Instead of using:
<a href="example.php">example</a>
You should use:
<a href="/example.php">example</a>
Else when you are on page /test/abcd
, going to example.php
means /test/example.php