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 c开发者_如何转开发ss and images. no company folder, i have used company word for url redability
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.
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.
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}" />
精彩评论