php - What's wrong with my htaccess-configuration? -
this htaccess-file web-root:
<ifmodule mod_deflate.c> # force compression mangled headers. # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping <ifmodule mod_setenvif.c> <ifmodule mod_headers.c> setenvifnocase ^(accept-encodxng|x-cept-encoding|x{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[x~-]{4,13}$ have_accept-encoding requestheader append accept-encoding "gzip,deflate" env=have_accept-encoding </ifmodule> </ifmodule> # compress output labeled 1 of following mime-types # (for apache versions below 2.3.7, don't need enable `mod_filter` # , can remove `<ifmodule mod_filter.c>` , `</ifmodule>` lines # `addoutputfilterbytype` still in core directives). <ifmodule mod_filter.c> addoutputfilterbytype deflate application/atom+xml application/javascript application/json application/rss+xml application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/svg+xml image/x-icon text/css text/html text/plain text/x-component text/xml </ifmodule> </ifmodule> # expire images header expiresactive on expiresdefault a0 expiresbytype image/gif a24592000 expiresbytype image/png a24592000 expiresbytype image/jpg a24592000 expiresbytype image/jpeg a24592000 expiresbytype image/x-icon a24592000 expiresbytype text/css a24592000 expiresbytype text/javascript a24592000 rewriteengine on #do not rewrite subdomains rewritecond %{http_host} ^(www\.)?legendaily\.com$ #redirect non-www www rewritecond %{http_host} !^www\. rewriterule ^(.*)$ http://www.%{http_host}/$1 [r=301,l] #only rewrite if it's not file , not /login/ rewritecond %{request_filename} !-f rewritecond %{request_uri} !^/login/ #rewrite /a/1 /index.php?action=a&urlid=1 rewriterule ^([^/]+)/([^/]+)/?$ index.php?action=$1&urlid=$2 [l,qsa] #rewrite /a /index.php?action=a rewriterule ^([^/]+)/?$ index.php?action=$1 [l,qsa] authname "restricted area" authtype basic authuserfile /path/to/.htpasswd authgroupfile /dev/null require valid-user and 1 use in /min-directory use http://code.google.com/p/minify/
<ifmodule mod_rewrite.c> rewriteengine on # may need rewritebase on servers #rewritebase /min # rewrite urls "/min/f=..." "/min/?f=..." rewriterule ^([bfg]=.*) index.php?$1 [l,ne] </ifmodule> <ifmodule mod_env.c> # in case addoutputfilterbytype has been added setenv no-gzip </ifmodule> now have 2 problems:
- the google-site-verification-file in root can't accessed google because it's rewritten
- i use subdomains cookie-freeness, i've added i.domain.com , s.domain.com server-configuration, if access s.domain.com/min, it's redirected web-root.
thanks help!
the line:
#do not rewrite subdomains rewritecond %{http_host} ^(www\.)?legendaily\.com$ probably needs changed to:
#do not rewrite subdomains rewritecond %{http_host} !^.+\.legendaily\.com$ [nc] so matches next rule excludes subdomains
conditions applied following rewrite rule need repeat ones apply more 1 rule. last rule:
rewriterule ^([^/]+)/?$ index.php?action=$1 [l,qsa] doesn't have conditions, , blindly rewrite /index.php, including files exist. need @ least !-f check:
rewritecond %{request_filename} !-f rewriterule ^([^/]+)/?$ index.php?action=$1 [l,qsa]
Comments
Post a Comment