Forum Moderators: phranque

Message Too Old, No Replies

Creating an htaccess file

         

Headwurdz

3:33 pm on Sep 9, 2010 (gmt 0)

10+ Year Member



I have a static html site that has a few urls the need to be 301 redirected to new pages and also needs the non-dub redirected to the dub.

I looked on the server and they have an empty htaccess file. I know how to do the necessary redirects, but I have never built an htacess file from scratch. I don't know if its as easy as copying the contents from another htacess file or not.

Can anyone point me to any reputable resources that can give me the info I need to create the file?

Thanks in advance

jdMorgan

5:34 pm on Sep 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



There are several useful resources cited in our Apache Forum Charter, several dozen introductory threads in our Apache Forum Library, and tens of thousands of threads findable here using a site search with the keywords you mentioned above on your favorite search engine...

Jim

Headwurdz

5:42 pm on Sep 9, 2010 (gmt 0)

10+ Year Member



I did use the search function on the site, but didn't come up with anything specific that related to htaccess samples, examples, etc.

I used the general search engines, but didn't know if any of the sites that were returned in the results were reputable. I didn't feel comfortable just following anyone's advice. That's why I created the post.

Based on your reply, I now see the links to the charter and the library, I must have overlooked them due to their size. So, I will go there to find the info I need. Thanks

jdMorgan

6:08 pm on Sep 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was recommending a site search, such as:
[google.com...]
(About 6,780 results) :)

To the best of my ability, I have seen to it that all threads in this Apache forum are "reputable" -- if they are read through to their conclusion and if all corrections are implemented as noted. I recommend doing the reading first, as you know what subject areas you might want to study-up on, and we can't possibly reproduce all that contributed/accumulated knowledge in one post or thread.

Plus, there is simply no "one-size-fits-all" answer, and server config code --whether in httpd.conf or in .htaccess-- is certainly NOT a cut-and-paste proposition. In fact, cutting and pasting code without fully understanding it is an excellent way to kill your search rankings and put yourself out of business... :o

Please post specific questions back here.

Jim

Headwurdz

6:13 pm on Sep 9, 2010 (gmt 0)

10+ Year Member



I'm reading through your library now.

Thanks

g1smd

7:07 pm on Sep 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



My first .htaccess file was three lines long, to do one particular thing I discovered was important to do.

Within weeks there were half a dozen things it had to do, and after a year more than double that again.

Every site is different, so you'll never implement the same file twice.

In general, in a basic file, there will be some stuff for access control, stuff for redirects, maybe some rewrites, some ErrorDocument directives, and a few other things.

Defining *what* you want to do is stage one of the process; and that is waaay before any coding starts, maybe days or weeks before.