469,622 Members | 1,670 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,622 developers. It's quick & easy.

how to create .htaccess file in PHP

254 100+
Hello I want to create .htaccess file in PHP and for website why do we require to have this file. means what are the advantage if I create.
Apr 10 '08 #1
5 1716
Markus
6,050 Expert 4TB
Hello I want to create .htaccess file in PHP and for website why do we require to have this file. means what are the advantage if I create.
.htaccess files are good for many things. One of the more notable possibilities with using .htaccess is the creation of 'pretty urls' where you take a url that looks like
Expand|Select|Wrap|Line Numbers
  1. www.somesite.com/?id=this&item=is&auth=now&p=pretty
Quite ugly, no? And change it into this:
Expand|Select|Wrap|Line Numbers
  1. www.somesite.com/this/is/now/pretty
Looks alot better, right?

This is all done with simple RewriteRule's

I've heard .htaccess files are pretty resource intensive though.. meaning theyre bandwidth hungry. Not sure about the credibility of this statement, though.

Hope this helps!
Apr 10 '08 #2
mukeshrasm
254 100+
.htaccess files are good for many things. One of the more notable possibilities with using .htaccess is the creation of 'pretty urls' where you take a url that looks like
Expand|Select|Wrap|Line Numbers
  1. www.somesite.com/?id=this&item=is&auth=now&p=pretty
Quite ugly, no? And change it into this:
Expand|Select|Wrap|Line Numbers
  1. www.somesite.com/this/is/now/pretty
Looks alot better, right?

This is all done with simple RewriteRule's

I've heard .htaccess files are pretty resource intensive though.. meaning theyre bandwidth hungry. Not sure about the credibility of this statement, though.

Hope this helps!
Thanks for the information. But how can I create .htaccess file
Apr 11 '08 #3
Markus
6,050 Expert 4TB
Thanks for the information. But how can I create .htaccess file
Create a file, any file, then save the file named as .htaccess

Simple.
Apr 11 '08 #4
mukeshrasm
254 100+
Create a file, any file, then save the file named as .htaccess

Simple.
ok but how the url wil look like this

www.somesite.com/this/is/now/pretty

as you have given example above.
Apr 11 '08 #5
Markus
6,050 Expert 4TB
ok but how the url wil look like this

www.somesite.com/this/is/now/pretty

as you have given example above.
Well you need to create a rule inside the file.

Try a tutorial on rewriting
Apr 11 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Marko Lahtinen | last post: by
8 posts views Thread by Joshua Beall | last post: by
7 posts views Thread by John | last post: by
1 post views Thread by John MacLeod | last post: by
reply views Thread by Jack Hambabo | last post: by
4 posts views Thread by Stefan Bellon | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.