I wanted my site to go from domain.com/page.php?id=1 to domain.com/page/1
Using RewriteRule ^page/(.*)$ page.php?id=$1
in .htaccess file works when going directly to domain.com/live/1, but the CSS is all messed up.
For example, instead of <link rel="stylesheet" href="style.css" type="text/css"/>
pointing to domain.com/style.css, it is pointing to domain.com/page/style.css
How can I fix this?? :( :(
Edit: Should I start using non-relative links (full path)?
The full .htaccess is:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^page/(.*)$ page.php?id=$1
开发者_StackOverflow
To solve this issue, I had to put <base href="http://domain.com/directory/" />
in the head of my page. The javascript files I had to make absolute paths since different browsers handle the base tag differently.
I've had this problem. It's because your browser now assumes /page/ is the root where it should start looking for css files etc, Simply put:
<base href="/">
In your
<head>.
Your browser will now strt looking for css files etc from the root of your website.
edit: nvm, messed up formatting because posting from my iPod but I see you resolved the issue already :)
To solve this issue, I had to put
in the head of my page. The javascript files I had to make absolute paths since different browsers handle the base tag differently.
精彩评论