In .htaccess
, I have put a simple RewriteRule
with two GET
variables in the URL:
RewriteRule ^myurl/([0-9a-zA-Z]+)/([0-9a-zA-Z]+) /folder_1/myfile.php?a=$1&b=$2
Inside folder_1
, there are two files: myfile.php
and myCSS.css
In myfile.php
, when I am having to refer to myCSS.css
, I am having to do:
<link href="../../folder_1/myCSS.css" rel="stylesheet">
The ../../
is needed to get past the two GET
variables set above.
But surely, there must be a better way, as I should be able to add more GET
variables and not having to change the relative URL to the CSS each time.
To fix this,you can add the following base tag to the head of your document :
<base href="http://example.com/">
For more info,see this post Seo Friendly Url css img js not working