apache - .htaccess scope of RewriteCond -
i'm creating .htaccess file need in server:
<ifmodule mod_rewrite.c> #enable rewrite engine rewriteengine on #rewrite base / if not local host rewritebase / #set base in case of local development rewritecond %{http_host} ^(.*)localhost(.*)$ rewritebase /~asafnevo/api #redirect every request index.php rewriterule ^(.*)$ api/index.php?request=$1 [qsa,nc] # prevent direct access access index.php rewritecond %{the_request} index\.php rewriterule ^(.*)index\.php$ - [f] </ifmodule>
i added the:
#set base in case of local development rewritecond %{http_host} ^(.*)localhost(.*)$ rewritebase /~asafnevo/api
in order have different base in localhost development environment, question when rewritecond ends?
i tried
rewritebase /~asafnevo/api [l]
but receive 500 error.
can please expend of scopes in matters of rewritecond ?
you using rewritebase
incorrectly. can't use [l]
flag because it's not rewriterule, hence 500 error getting. can have 1 rewritebase
in rules. if file has multiple bases, use last one. start cause problems if tried use in production multiple rewritebase
's.
the rewritebase directive specifies url prefix used per-directory (htaccess) rewriterule directives substitute relative path.
http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
and rewritecond used rules.
http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond
you have edit .htaccess if you're on local box or keep 2 copies , rename when need locally.
Comments
Post a Comment