My mod_rewrite code is:
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)?$ index.php?url=$1 [L,NC]
This structure is placed on my server path /beta
When I place the URL http://mydomain.com/beta/download everything works rewriting to the real path http://mydomain.com/beta/index.php?url=download
The problem happens with the relative paths. When I enter the URL http://mydomain.com/beta/download/box the rewriting goes to http://mydomain.com/beta/index.php?url=download/box… but….
All my relative paths, like my css folder, my js folder, image files…. everything with relative path in my index.php page crashes, cuz my relative paths become download/css, download/js, download/images… etc…
I know this problem happens in reason of the slash in the path “download/”, but how can I solve that using the mod_rewrite in .htaccess?
Can I prevent rewriting in relative paths? Or even in internal paths of my own domain?
How can I solve that WITHOUT change my relative paths to absolute paths?
Thanks
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