0

I am currently (trying) rewriting my URLs by creating rules in .htaccess file. Quite simple for the moment my .htaccess is as folow:

 Options +FollowSymlinks  
 RewriteEngine on

 AddType text/css .css  
 RewriteRule ^lunettes-collection/([a-zA-Z]+)/([a-zA-Z]+)$ lunettes-collection.php?supplier=$1&type=$2 [L]

So my old url is http://localhost/myoptical/lunettes-collection.php?supplier=all&type=vue (and works perfectly) And my new url is : http://localhost/myoptical/lunettes-collection/all/vue (and has no style and js)

When I reach the new url I got the content of the page but I got the following error in the console log.

GET http://localhost/myoptical/lunettes-collection/all/css/owl.transitions.css GET http://localhost/myoptical/lunettes-collection/all/myoptical/js/jquery-2.1.0.min.js

As I understand there is a problem on the path of each file. How I can specificy the right path to my script/css files?

1 Answer 1

4

You need to either change all your links to absolute URL's or create a relative URL base in your page header (between the <head> and </head> tags)

<base href="/myoptical/" />

Or change all your urls so that they start with /myoptical/.

Sign up to request clarification or add additional context in comments.

2 Comments

Hi thanks, for your help. In fact it works now when I set the /myoptical/ before the file. But I do not understand how do you insert the <base href="/myoptical/"/> and how do you use it (fyi, i am in php?
@Skunkies as my answer says: between the <head> and </head> tags

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.