php - URL modified from each click after change in htaccess -
i modifying php script seo friendly
when click first time on link in test.php page displaying in url htp://example/test/first working fine. when click on second time url become htp://example/test/test/first.test folder keep on adding url
how reslove issue.
##test.php <html> <head></head> <body> <a href='test/first'>testing</a> <br> <body> </html> ##.htaccess rewriteengine on rewritebase rewritecond %{request_filename} !-d rewritecond %{request_uri} /$ rewriterule (.*)/ $1 [r=301] rewriterule ^test/(.+) /test.php?$1 [l] directoryindex test.php
several possibilities solve this.
1) slash in front of url
<a href='/test/first'>testing</a>
which work if website isn't contained in sub directory of web space
2) absolute url
<a href='http://www.example.com/test/first'>testing</a>
you can save in config file or (baseurl anyone?) , append links dynamically this
<a href='<?=$cfg->baseurl?>/test/first'>testing</a>
3) html
set base in head-tag this
<base href="http://example.com/">
which might break other paths on site image-paths , css paths
Comments
Post a Comment