Deoctor Posted March 20, 2012 Share Posted March 20, 2012 Hai i have found this rewrite while searching. Could someone explain me what it does. RewriteEngine on RewriteCond %{HTTP_HOST} \.(localhost)\. RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.html -f RewriteRule ^(.*)$ $1.html Quote Link to comment https://forums.phpfreaks.com/topic/259318-could-some-body-explain-me-what-this-does/ Share on other sites More sharing options...
requinix Posted March 20, 2012 Share Posted March 20, 2012 Enable URL rewriting If the domain name contains ".localhost." and The request does not refer to a directory and There exists a file named "(request).html" then (1) Set $1 to the request and (2) continue processing as if the request was actually for "$1.html" instead Quote Link to comment https://forums.phpfreaks.com/topic/259318-could-some-body-explain-me-what-this-does/#findComment-1329316 Share on other sites More sharing options...
Deoctor Posted March 20, 2012 Author Share Posted March 20, 2012 Thanks for the reply. I have one more doubt. I guess the RewriteCond %{HTTP_HOST} would not be necessary if i am using this on a single site right coz i have tried this RewriteEngine on #RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php and it is working fine Quote Link to comment https://forums.phpfreaks.com/topic/259318-could-some-body-explain-me-what-this-does/#findComment-1329318 Share on other sites More sharing options...
gizmola Posted March 20, 2012 Share Posted March 20, 2012 In practicality, the only way the host name is going to contain "localhost" is if you are running the browser you are testing with, on the same machine that apache is running on. This is a common thing that people do with WAMP/XAMP/MAMP etc., or sometimes as a security feature, where the assumption is that the server will have a working browser, to facilitate setup/installation. In summary, that's not a common RewriteCond, and not appropriate for a production server. Quote Link to comment https://forums.phpfreaks.com/topic/259318-could-some-body-explain-me-what-this-does/#findComment-1329321 Share on other sites More sharing options...
Deoctor Posted March 20, 2012 Author Share Posted March 20, 2012 Thank you for your reply.yes what you have guessed is correct i am testing it in my local server before implementing it on the production server. but as you can see in my second post i have eliminated this and could able to achieve what i have opted for. Quote Link to comment https://forums.phpfreaks.com/topic/259318-could-some-body-explain-me-what-this-does/#findComment-1329323 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.