.htaccess - First slash is removed after domain when entering a webpage in the browser -
sometimes when hit address of webpage in browser, removes first slash after domain.
examples:
www.mywebsite.com/scripts/script_6.php -> trying load www.mywebsite.comscripts/script_6.php www.mywebsite.com/test.php -> trying load www.mywebsite.comtest.php
after entering again, loads page.
a .htaccess settings must wrong:
rewritebase / errordocument 404 http://www.mywebsite.com/oops.php errordocument 401 /notallowed.php rewriteengine on # turn on rewriting engine #gzip <ifmodule mod_deflate.c> addoutputfilterbytype deflate text/text text/html text/plain text/xml text/css application/x- javascript application/javascript </ifmodule> #end gzip rewritecond %{http_host} ^mywebsite\.com rewriterule ^(.*)$ http://www.mywebsite.com$1 [r=permanent,l] directoryindex index6.php rewriterule ^termsofuse/?$ termsofuse.php [nc,l] # handle requests "adpolicy" rewriterule ^privacy-policy/?$ privacy-policy.php [nc,l] # handle requests "adpolicy" rewriterule ^newcampaign/?$ newcampaign.php [nc,l] # handle requests "newcampaign" rewriterule ^howitworks/?$ howitworks3.php [nc,l] # handle requests "howitworks" rewriterule ^signin/?$ login.php [nc,l] # handle requests "signin" rewriterule ^reset_password/?$ reset_password.php [nc,l] # handle requests "register" rewriterule ^error404/?$ oops2.php [nc,l] # handle requests "register" rewriterule ^error/?$ oops2.php [nc,l] # handle requests "register" rewriterule ^error401/?$ notallowed.php [nc,l] # handle requests "register" rewriterule ^notallowed/?$ notallowed.php [nc,l] # handle requests "register" #php_flag display_startup_errors on #php_flag display_errors on #php_flag html_errors on #php_flag log_errors on #php_value error_log php_errors.log addtype text/x-component .htc #ez lehet nem kell mert gzip van # compress text, html, javascript, css, , xml setoutputfilter deflate addoutputfilterbytype deflate text/plain addoutputfilterbytype deflate text/html addoutputfilterbytype deflate text/xml addoutputfilterbytype deflate text/css addoutputfilterbytype deflate application/xml addoutputfilterbytype deflate application/xhtml+xml addoutputfilterbytype deflate application/rss+xml addoutputfilterbytype deflate application/javascript addoutputfilterbytype deflate application/x-javascript # remove browser bugs browsermatch ^mozilla/4 gzip-only-text/html browsermatch ^mozilla/4\.0[678] no-gzip browsermatch \bmsie !no-gzip !gzip-only-text/html header append vary user-agent #enable browser caching #<filesmatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$"> header set cache-control "max-age=2592000" header append cache-control "public" #</filesmatch> #vary: accept-encoding header <ifmodule mod_headers.c> <filesmatch "\.(js|css|xml|gz|html)$"> header append vary: accept-encoding </filesmatch> </ifmodule> # enable expirations <ifmodule mod_expires.c> expiresactive on expiresbytype image/jpg "access 1 month" expiresbytype image/jpeg "access 1 month" expiresbytype image/gif "access 1 month" expiresbytype image/png "access 1 month" expiresbytype text/css "access 1 month" expiresbytype text/html "access 1 month" expiresbytype application/pdf "access 1 month" expiresbytype text/x-javascript "access 1 month" expiresbytype application/x-shockwave-flash "access 1 month" expiresbytype image/x-icon "access 1 year" expiresdefault "access 1 month" </ifmodule> #enable compression <ifmodule mod_gzip.c> mod_gzip_on yes mod_gzip_dechunk yes mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^content-encoding:.*gzip.* </ifmodule> <ifmodule mod_headers.c> header set connection keep-alive </ifmodule>
it due www
enforcing rule. remember captured string in rewriterule
doesn't have leasing /
.
replace with:
rewritecond %{http_host} ^mywebsite\.com$ [nc] rewriterule ^ http://www.mywebsite.com%{request_uri} [r=301,l,ne]
make sure test out in new browser avoid browser caching issues.
Comments
Post a Comment