.htaccess - htaccess rewrite not working as expected just change my address in addressbar, no rewriting at all -
i have folder/file structure as:
rootfolder/ lowres/lowres.php hires/hires.php sys.php
basically, want rewrite such when user calls page site.com/img_0001_hq.html, .htaccess rewrite sys.php?1=img_0001_hq. also, want limit acceptable emdings ".html" , "/" , if ending not present want call sys.php?1=p_404. rewriting doing expected when comes errors...
when call page site.com/hires/hires.php or site.com/lowres/lowres.php, rewriting not working, scripts (hires.php , lowres.php) run, , report errors, in lack of variables sys.php not triggered. also, when call pages site.com/hires or site.com/lowres, sys.php runs, but, wrong. also, when calling these addresses, address in browser changes site.com/hires/?1=p_404 or site.com/lowres/?1=p_404. heck going on?! :d
oh, yeah, .htaccess looks this:
indexignore * rewriteengine on rewriterule ^(.*)(/|.html)$ sys.php?1=$1 [l] rewriterule ^(.*)$ sys.php?1=p_404 [l]
i going nuts on this... :)
try adding conditions exclude sys.php (and whatever else don't want re-written). what's happening after first rewrite, uri becomes sys.php
, put through rewrite engine (mod_rewrite until either uri stops changing or reaches maximum number of internal redirects, causing 500 server error):
indexignore * rewriteengine on rewritecond %{request_uri} !sys\.php rewriterule ^(.*)(/|.html)$ sys.php?1=$1 [l] rewritecond %{request_uri} !sys\.php rewriterule ^(.*)$ sys.php?1=p_404 [l]
Comments
Post a Comment