Reputation: 1257
i am using a Rewrite rule for my site but its changing changing script src Path
here is the rule i am using
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .* - [L]
RewriteRule ^(.*)$ /user_page.php?id=$1 [NC]
# Changing Search URL
RewriteRule ^/([^/]*)/([^/]*)/([^/]*)$ search_out.php?comp_city=$1&one=$2comp_landmark=$3 [L]
# Changing Search URL is the one which is causing prob ... page it will show u the script src or all link rel="stylesheet" type="text/css" are pointed to http://www.xxxxx.com/Rajpura/Schools/js/jquery-1.6.2.min.js rather than http://www.xxxxx.com/js/jquery-1.6.2.min.js
Please help
Upvotes: 1
Views: 340
Reputation: 7739
You can add the base tag to the head tag in each of your pages :
<base href="/">
This way, the browser will prepend all the links in that page by /.
For more informations about the base tag, see documentation
Upvotes: 2
Reputation: 4601
And when embedding CSS or images in your html, try to begin with a slash to get the files from the root directory:
<link rel="stylesheet" href="/css/style.css" />
The same with images:
<img src="/images/pic.png" alt="image" />
<img src="/mypic.png" alt="image" />
Or a Workaround would be is to add this in your template :
<base href="/">
This will force browsers to prepend the / (in this example) to all relative resource links.
Upvotes: 0