javascript - Link not opening properly after hiding file extension using htaccess -


i have used ht-access hide .php file extension. inside .htaccess file code :

# apache rewrite rules <ifmodule mod_rewrite.c> options +followsymlinks rewriteengine on rewritebase /  # add trailing slash url rewritecond %{request_filename} !-f rewritecond %{request_uri} !(\.[a-za-z0-9]{1,5}|/|#(.*))$ rewriterule ^(.*)$ $1/ [r=301,l]  # remove .php-extension url rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^([^\.]+)/$ $1.php   # end of apache rewrite rules </ifmodule> 

it's hiding .php file extension well. but problem that, link inside href attribute not opening properly.

i have 2 files:

public_html/afiliate/product_details.php

public_html/afiliate/afiliate_login.php

inside product_details.php have given link of afiliate_login.php this

<a href="afiliate_login.php" target="_blank">log in</a> 

clicking log in should go page like

example.com/afiliate/afiliate_login/

but takes me

example.com/afiliate/product_details/afiliate_login/

and hence 404 error

again notice that, if manually type url

example.com/afiliate/afiliate_login/

that's ok, goes page expected.

now how can make links work properly?

previously browser considered product_details.php file. folder, because product_details/

one option available here update link's

<a href="../afiliate_login.php" target="_blank">log in</a> 

but suggested link below

<a href="/afiliate_login" target="_blank">log in</a> 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -