javascript - php:Mod rewrite giving me hard times finding base address.. need help -
im new mod_rewrite problem ruins ajax , php
i use windows.location object current location javascript example:
var str = location.pathname; str=str.slice(0,str.lastindexof('/'));
problem never works since used mod_rewrite. .htaccess
options +followsymlinks rewriteengine on rewriterule ^cars/([^/]+)/?$ profiles.php?carname=$1 [l]
can body lead me way fix this. ? face same problem lading imgs , css/.js heard can write condition on .htaccess redirect .php !,
i need way find base address ajax calls, , other way find base address php.
the problem redirecting url php file , breaks other assets, including css , js.
solution:
use rewrite condition. way redirects if file or directory doesn't exist.
rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^cars/([^/]+)/?$ profiles.php?carname=$1 [l]
the first line : if file doesn't exist second is: if directory doesn't exist there redirect.
Comments
Post a Comment