URL Rewriting adding slash at the end breaks my css links

前端 未结 3 1348
一整个雨季
一整个雨季 2021-01-23 03:58

I\'m using Apache mod_rewrite to rewrite my url\'s in a PHP application. I have a login.php in my application root. I wrote the following lines in .htaccess file (I\'m using HTM

3条回答
  •  甜味超标
    2021-01-23 04:08

    When your browser goes to http://example.com/signin/ the relative base URI becomes /signin/. This means every relative link in the content of that entire page will have /signin/ appended to it as the URL base. The original link was just /login.php, which makes the base URI /. Your browser doesn't know anything about your rewrite rules, just what it sees in the location bar.

    You need to change all your links to absolute URLs (with a leading /) or specify a relative base URI in the page's header (inside the tags):

    
    

提交回复
热议问题