.htaccess - RewriteCond - What am I doing wrong? -
i'm using opencart seo friendly url's turned on.
that's made .htaccess file this
rewriterule ^sitemap.xml$ index.php?route=feed/google_sitemap [l] rewriterule ^googlebase.xml$ index.php?route=feed/google_base [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !.*\.(ico|gif|jpg|jpeg|png|js|css) rewriterule ^([^?]*) index.php?_route_=$1 [l,qsa] but need add in folder exception doesn't rewritten, /emailer
looking around web @ answers did following:
rewritecond %{request_uri} !^/(emailer|js|css)/ [nc] rewriterule ^ - [l] rewriterule ^sitemap.xml$ index.php?route=feed/google_sitemap [l] rewriterule ^googlebase.xml$ index.php?route=feed/google_base [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !.*\.(ico|gif|jpg|jpeg|png|js|css) rewriterule ^([^?]*) index.php?_route_=$1 [l,qsa] that makes /emailer/ work, other rewriting doesn't. know i'm doing wrong here?
you insert before main rewriterule.
rewritebase / rewriterule ^sitemap.xml$ index.php?route=feed/google_sitemap [l] rewriterule ^googlebase.xml$ index.php?route=feed/google_base [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !^\/(emailer|js|css) [nc] rewritecond %{request_uri} !\.(ico|gif|jpg|jpeg|png|js|css)$ [nc] rewriterule ^([^?]*) index.php?_route_=$1&request_uri=%{request_uri} [l,qsa] note: it's not tested, should give idea how it.
later edit:
i have tested code , didn't work. have edited , works now, this:
rewritecond %{request_filename} !-f=> if request not real filenamerewritecond %{request_filename} !-d=> if request not real directoryrewritecond %{request_uri} !^\/(emailer|js|css) [nc]=> if there not directory/file in root starts words emailer/js/cssrewritecond %{request_uri} !\.(ico|gif|jpg|jpeg|png|js|css)$ [nc]=> if request not end extension of following ico/gif/jpg/jpeg/png/js/css
notes:
to test if need forward slash or not in rewrite rule, append query variable did in modified example , print (on first line after php open tag) in index.php file this:
print_r($_get['request_uri']); exit;
after done testing, remove request_uri htacces , index.php.
- always escape forward slash backslash, \ /
Comments
Post a Comment