开发者

Rewrite base rule- php

开发者 https://www.devze.com 2023-01-07 09:22 出处:网络
Internal URL:开发者_如何学编程 example.com/abc/xyz/rule.php?price=1&pass=2 External URL: example.com/abc/xyz/rule/1/2

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


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
0

精彩评论

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