My mod_rewrite code is:
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
Rewrite
Adding the line:
<BASE href="http://www.sitename.com/">
to my page inside the <head>
tag works great for me. It can be coded even a PHP function to automatize this so you don't have to bother with copy/paste on other occasions.
Update:
<?php
$BaseDir = 'http://'.$_SERVER['SERVER_NAME'].substr($_SERVER["SCRIPT_NAME"], 0, strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
?>
<head>
...
<BASE href="<?php echo $BaseDir; ?>">
...
</head>
you should always use absolute paths for images css etc, when playing with mod_rewrite but simple solution might be to ignore css,js, images and rest in RewriteRule ^(.+)?$ index.php?url=$1 [L,NC]
RewriteRule ((js|css|images)\/.*)$ /$1 [L,NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)?$ index.php?url=$1 [L,NC]
however this might not work if these dirs actually depend of the current url
I've tested the tag and there's no need to indicate http:// The following code worked for me:
<base href="<?php echo dirname($_SERVER['PHP_SELF']);?>/" />
The server won't ever know whtether the request came via relative or absolute path so there is nothing You can do about it. As stated in another answer, You could make exceptions but maintaining all of them etc will become PITA at some point. ;)
I always use absolute paths especially when rewriting so I'd suggest just that, it's the easiest way
Add a <base href="yoururl.com/beta/"; />
tag to your HTML head. Also add RewriteBase /beta/ to the htaccess if you're in that subfolder