I think I've gone through a million articles and everyone's codes on this, but I just can't get it to work! Every code I try works but 开发者_StackOverflow中文版it shows the redirect url instead of the virtual one.
I would like mysite.com/company/client/ to actually show the results from mysite.com/company/client.php, but the files within client.php become broken unless I make absolute links.
For instance mysite.com/company/css/style.css is broken when viewing from http://mysite/company/client/, but is working fine when going to the real file mysite.com/company/client.php
I hope someone knows how to solve this problem without having to change all links in client.php to absolute!
Thanks!
Scott
You might want to consider the HTML BASE tag:
...
<head>
...
<base href="http://mysite/company" />
...
</head>
...
You put this in the client.php file, then any relative link & reference is automatically "converted" to an absolute one, starting from the right folder.
See the comments on possible issues with the BASE tag. Another option would be to perform a redirect instead of a rewrite, by adding "[R]" to the RewriteRule. However, then your users will see the "client.php" in the URL.
精彩评论