Welcome Guest!
Please login
If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:
- Receive Fast Advice
- Learn Programming Languages
- Get Professional Website Reviews
- Quick Troubleshooting Assistance
|
|
.htacces Files
This is a discussion on .htacces Files, within the Beginners' Questions section. This forum and the thread ".htacces Files" are both part of the Designing Your Website category.
![]() ![]() |
Apr 12 2008, 10:16 PM
Post
#1
|
|
![]() Rapid Squeezer ![]() ![]() ![]() ![]() Group: Members Posts: 199 Joined: 15-February 08 From: Plymouth Member No.: 153 |
As I'm going to be changing all of my extensions to .shtml due to the 'includes', I'm going to need to put a redirect on the old pages (SEO reasons). I'd rather not put some redirecting code into the old pages but I have heard about doing this via the .htaccess file.
CODE Options +FollowSymLinks Redirect 301 /whatever.html http://www.domainname.com/whatever.shtml Obviously each page will be specified, but would I need to add anything else to this file? Or am I whistling in the wind again? I don't really want to use a customised error404 page if I can help it. Thanks -------------------- QUOTE I'm challenged enough without any extra weirdness in my life! |
|
|
Apr 12 2008, 10:41 PM
Post
#2
|
|
![]() Rapid Squeezer ![]() ![]() ![]() ![]() Group: Mentor Posts: 204 Joined: 14-February 08 From: NY, USA Member No.: 127 |
No, stop, don't do it!
Ok, so that was a bit over dramatic, but you don't need to do that. Put this in your .htaccess file instead of the redirect... CODE AddHandler server-parsed .html This will tell the server to parse your .html files the same way it would parse your .shtml files. Then all you have to do is rename the .shtml files to .html and the SSIs will work just the same. Now, give it a shot and see if it works with the code I gave you because it may differ a little depending on your server. Let me know how it goes and/or if you have any questions. Rich Oh, you should never use a 301 unless a page that was indexed previously have been removed from the server or changed to a new page, and the initial page will never be used again as there is a (slight) chance that page may never show up in the index again. If you think you may use the old page again in the future you should use a 307. -------------------- |
|
|
Apr 13 2008, 06:01 PM
Post
#3
|
|
![]() Rapid Squeezer ![]() ![]() ![]() ![]() Group: Members Posts: 199 Joined: 15-February 08 From: Plymouth Member No.: 153 |
No, stop, don't do it! Ok, so that was a bit over dramatic, but you don't need to do that. Put this in your .htaccess file instead of the redirect... This will tell the server to parse your .html files the same way it would parse your .shtml files. Then all you have to do is rename the .shtml files to .html and the SSIs will work just the same. Now, give it a shot and see if it works with the code I gave you because it may differ a little depending on your server. Let me know how it goes and/or if you have any questions. Rich QUOTE Oh, you should never use a 301 unless a page that was indexed previously have been removed from the server or changed to a new page, and the initial page will never be used again as there is a (slight) chance that page may never show up in the index again. If you think you may use the old page again in the future you should use a 307 301=redirect, 307=?? Just how many are there, and what are they all used for? If there's a lot, is there a link/page that I could look at? Not that I'd do anything without checking here first! I have another htaccess question if that's okay. Currently there are different "sites" hosted on the same IP address. At the moment the main site has a .htaccess file (with a custom error page redirect - which actually works!!) However there are also 4 subdomains that all need custom error pages (as they all have different menus). Would each subdomain need its own separate .htaccess file? Is this even possible/viable? Thanks again This post has been edited by Popje: Apr 13 2008, 06:03 PM -------------------- QUOTE I'm challenged enough without any extra weirdness in my life! |
|
|
Apr 14 2008, 02:26 AM
Post
#4
|
|
![]() Rapid Squeezer ![]() ![]() ![]() ![]() Group: Advisors Posts: 431 Joined: 14-February 08 From: Stockport Member No.: 75 |
Not too sure on the htaccess question, but here are the error codes mate
http://www.hooverwebdesign.com/templates/h...rror-codes.html -------------------- |
|
|
Apr 14 2008, 10:51 AM
Post
#5
|
|
![]() Rapid Squeezer ![]() ![]() ![]() ![]() Group: Mentor Posts: 204 Joined: 14-February 08 From: NY, USA Member No.: 127 |
There are a bunch of different HTTP codes. 307=temporary redirect, 404=not found, 200=ok, etc. Here's a link...
HTTP Status Codes QUOTE However there are also 4 subdomains that all need custom error pages (as they all have different menus). Would each subdomain need its own separate .htaccess file? Is this even possible/viable? Yes, it is possible to have separate .htaccess files for each subdomain, but the way it works depends on your host. The best thing to do would be to just try a new .htaccess file in the root directory of your subdomain(s) that specifies the custom 404 page. If it doesn't work then you'll have to troubleshoot the config. Probably the easiest thing to do would be to contact the host as they *should* be able to just tell you the right way to do it. Rich -------------------- |
|
|
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | |||
|---|---|---|---|---|---|---|---|
![]() |
9 | 4lun | 169 | 22nd February 2008 - 01:27 PM Last post by: thesealportalteam |
|||
![]() |
3 | Mark | 91 | 1st April 2008 - 08:47 AM Last post by: JustinStudios |
|||
![]() |
10 | unitedcraig | 190 | 18th April 2008 - 03:14 PM Last post by: paintingtheweb |
|||
![]() |
10 | Popje | 241 | 2nd May 2008 - 06:10 PM Last post by: Popje |
|||
![]() |
6 | MikeHopley | 338 | 15th August 2008 - 10:54 AM Last post by: MikeHopley |
|||







Apr 12 2008, 10:16 PM









