问题
Internal URL: example.com/abc/xyz/rule.php?price=1&pass=2
External URL: example.com/abc/xyz/rule/1/2
But the css, js files are not coming into effect in the external URL. My .htaccess file:
RewriteEngine On
RewriteBase /example.com/abc/
RewriteRule ^rule/([0-9]+)/([0-9]+)/?$ rule.php?price=$1&pass=$2
回答1:
The “problem” is that relative URLs are resolved by the client and not by the server. And the base URL, the relative URLs are resolved from, is the URL of the current document. And in your case the base URL (path) is /abc/xyz/rule/1/2
and not /abc/xyz/rule.php?price=1&pass=2
.
Now you have several ways to solve this:
- Use relative URLs that are correctly resolvable from the actual base URL
/abc/xyz/rule/1/2
- Use absolute URLs that are independent from the base URL
- Alter the base URL using HTML’s BASE element
来源:https://stackoverflow.com/questions/3264285/rewrite-base-rule-php