开发者

Url rewriting issue

开发者 https://www.devze.com 2022-12-23 22:29 出处:网络
i have used the following code in .htaccess Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteRule ^company/aboutus$ aboutus.php[NC,L]

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}" />
0

精彩评论

暂无评论...
验证码 换一张
取 消