Suriyan Suresh
Suriyan Suresh

Reputation: 3024

Url rewriting issue

i have used the following code in .htaccess

Options +FollowSymlinks
RewriteEngine On 
RewriteBase /
RewriteRule ^company/aboutus$ aboutus.php  [NC,L]
RewriteRule ^company/contactus$ contactus.php  [NC,L]
RewriteRule ^company/careers$ careers.php  [NC,L]
RewriteRule ^/$ index.php  [NC,L]

the above code works but aboutus page loading without any css and images. no company folder, i have used company word for url redability

Upvotes: 0

Views: 38

Answers (3)

Max Shawabkeh
Max Shawabkeh

Reputation: 38603

This is because the browser is trying to lookup your stylesheet in /company. Use an absolute URL when linking rewritten files (e.g. /styles.css) or use the HTML <base> tag to specify from where the URLs should be resolved.

Upvotes: 1

Sasha
Sasha

Reputation: 1190

Well, it sounds like the problem is that the HTML you are outputting probably refers to relative paths relative to /, and not company/. You could use absolute paths or do something like this in your HTML:

<base href = "{your base url}" />

Upvotes: 0

SpliFF
SpliFF

Reputation: 38956

Because you're using relative paths and now the browser thinks the CSS is somewhere it's not. You'll have to update your links or move your CSS files to the level the browser thinks it's at. You could also set a base href but I don't recommend that as it can cause confusion down the track.

Upvotes: 0

Related Questions