I’m working in PHP but didn’t know about htaccess. And these days I know how much the value of htaccess. So, I decide to learn first htacces then step forward. But don’t know from where I should start? Please provide your guidelines. I want to learn complete tips & tricks about htaccess. I know something but I want to learn more techniques. Like I want to create SEO friendly url and other category url’s. Thanks in advance.
4
Answers
You should check
http://htaccess-guide.com/
It is pretty detailed.
Official How-To / Tutorials are located here: http://httpd.apache.org/docs/current/howto/htaccess.html
But there are plenty of resources out there in the wild.
You can try these links :
A tutorial for beginers
Tutorial for mod-rewrite beginners
https://amitoverflow.com/2021/04/15/htaccess-tutorial-for-beginers/
.htaccess file)
http://www.javascriptkit.com/howto/htaccess.shtml
URL rewriting Tutorial
URL Rewriting)
http://www.smashingmagazine.com/2011/11/02/introduction-to-url-rewriting/
Apache official Documentation)
http://httpd.apache.org/docs/current/howto/htaccess.html
Ok, first thing is, you should avoid using
.htaccess
if possible. It’s not about using.htaccess
to get what you need it’s about using the Apache directives. If you have access to Apache config or vhost that is much better as any directive can be used there. Please start with when not to use.htaccess
directly from Apache at the link below.When not to use .htaccess
Using
.htaccess
gives a small performance hit on the server for every request because it scans every directory looking for this file to apply any directives.Most big sites don’t use .htaccess, they put it in the config or vhost file and leaves it with
AllowOverride None
.Now one of the most important things you will need to know is
mod_rewrite
.Mod_rewrite
uses Regex for most of it’s pattern matching.http://httpd.apache.org/docs/current/mod/mod_rewrite.html
This site is helpful in understanding regex because it is quite complicated at first and still can be even with experience.
http://www.regular-expressions.info/tutorial.html
You will also probably want to look over what can be done with Apache in general versus how to use just
.htaccess
.Learning the core features will help you a lot and it tell you which features can be used with
.htaccess
or only Confighttp://httpd.apache.org/docs/2.4/mod/core.html