.htaccess - Unable to get rid of 302 redirect -
i have following in htaccess file:
# use front controller index file. serves fallback solution when # every other rewrite/redirect fails (e.g. in aliased environment without # mod_rewrite). additionally, reduces matching process # start page (path "/") because otherwise apache apply rewriting rules # each configured directoryindex file (e.g. index.php, index.html, index.pl). directoryindex app.php <ifmodule mod_rewrite.c> rewriteengine on # determine rewritebase automatically , set environment variable. # if using apache aliases mass virtual hosting or installed # project in subdirectory, base path prepended allow proper # resolution of app.php file , redirect correct uri. # work in environments without path prefix well, providing safe, one-size # fits solution. not need in case, can comment # following 2 lines eliminate overhead. rewritecond %{request_uri}::$1 ^(/.+)/(.*)::\2$ rewriterule ^(.*) - [e=base:%1] # sets http_authorization header removed apache rewritecond %{http:authorization} . rewriterule .* - [e=http_authorization:%{http:authorization}] # redirect uri without front controller prevent duplicate content # (with , without `/app.php`). redirect on initial # rewrite apache , not on subsequent cycles. otherwise # endless redirect loop (request -> rewrite front controller -> # redirect -> request -> ...). # in case "too many redirects" error or redirected # start page because apache not expose redirect_status # environment variable, have 2 choices: # - disable feature commenting following 2 lines or # - use apache >= 2.3.9 , replace l flags end flags , remove # following rewritecond (best solution) rewritecond %{env:redirect_status} ^$ rewriterule ^app\.php(/(.*)|$) %{env:base}/$2 [r=301,l] # if requested filename exists, serve it. # want let apache serve files , not directories. rewritecond %{request_filename} -f rewriterule .? - [l] # rewrite other queries front controller. rewriterule .? %{env:base}/app.php [l] </ifmodule> <ifmodule !mod_rewrite.c> <ifmodule mod_alias.c> # when mod_rewrite not available, instruct temporary redirect of # start page front controller explicitly website # , generated links can still used. redirectmatch 302 ^/$ /app.php/ # redirecttemp cannot used instead </ifmodule>
each time enter in url domain name without www example.com see 302 redirect. how can fix this?
i tried adding following:
rewritecond %{https}s ^on(s)| rewriterule ^(.*)$ http%1://www.%{http_host}/$1 [r=301,l]
but above did not resolve issue.
Comments
Post a Comment