Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Ezilon Directory   World's Leading Outsourcing Network   V7N Directory

Reply
 
LinkBack Thread Tools Display Modes
Old 05-26-2007, 04:02 PM   #1 (permalink)
Inactive
 
Join Date: 04-01-07
Posts: 21
iTrader: 0 / 0%
Latest Blog:
None

offthedome is liked by many
301 redirect help!!

Hi, I'm trying to work with tutorials for .htaccess files to do 301 redirects, but either I suck or they suck

Anyway, hopefully someone can just tell me how to do this. I need to do the following:

1. make example.com/folder/ go to example.com/folder/index.php
2. Make a specific folder example.com/ccc/ddd/eee/ go to example.com/ccc/ddd/eee/page01/

Can someone just tell me how to do this?
offthedome is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 05-26-2007, 09:00 PM   #2 (permalink)
Contributing Member
 
exam's Avatar
 
Join Date: 04-20-06
Posts: 333
iTrader: 0 / 0%
Latest Blog:
None

exam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web pro
.htaccess file:
Code:
redirect 301 /folder/ http://example.com/folder/index.php redirect 301 /ccc/ddd/eee/ http://example.com/ccc/ddd/eee/page01/
exam is offline  
Add Post to del.icio.us
Reply With Quote
Old 05-26-2007, 10:20 PM   #3 (permalink)
Inactive
 
Join Date: 04-01-07
Posts: 21
iTrader: 0 / 0%
Latest Blog:
None

offthedome is liked by many
Quote:
Originally Posted by exam View Post
.htaccess file:
Code:
redirect 301 /folder/ http://example.com/folder/index.php redirect 301 /ccc/ddd/eee/ http://example.com/ccc/ddd/eee/page01/
Sweet. I'll try it tomorrow.
offthedome is offline  
Add Post to del.icio.us
Reply With Quote
Old 05-27-2007, 05:13 AM   #4 (permalink)
Contributing Member
 
exam's Avatar
 
Join Date: 04-20-06
Posts: 333
iTrader: 0 / 0%
Latest Blog:
None

exam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web proexam is a highly respected web pro
That's how to redirect just one or a few pages with the .htaccess file. If you want to redirect many pages using rules (eg: all the sub-pages of a directory to the same page in another directory), you'll need a rewrite rule.
exam is offline  
Add Post to del.icio.us
Reply With Quote
Old 05-27-2007, 02:00 PM   #5 (permalink)
Inactive
 
Join Date: 04-01-07
Posts: 21
iTrader: 0 / 0%
Latest Blog:
None

offthedome is liked by many
Quote:
Originally Posted by exam View Post
.htaccess file:
Code:
redirect 301 /folder/ http://example.com/folder/index.php redirect 301 /ccc/ddd/eee/ http://example.com/ccc/ddd/eee/page01/
the way you wrote that code, it seems the .htaccess file goes into the base folder. I need the .htaccess file to be located in /folder/, i.e. the same folder as index.php
offthedome is offline  
Add Post to del.icio.us
Reply With Quote
Old 05-27-2007, 04:42 PM   #6 (permalink)
Inactive
 
MadKad's Avatar
 
Join Date: 12-14-05
Location: UK
Posts: 1,172
iTrader: 0 / 0%
Latest Blog:
Have your own blog

MadKad is a highly respected web proMadKad is a highly respected web proMadKad is a highly respected web proMadKad is a highly respected web proMadKad is a highly respected web proMadKad is a highly respected web proMadKad is a highly respected web proMadKad is a highly respected web proMadKad is a highly respected web proMadKad is a highly respected web proMadKad is a highly respected web pro
just change the roots around to suite

aslong as the redirect 301 are in they will work to go to the root you need
MadKad is offline  
Add Post to del.icio.us
Reply With Quote
Old 05-27-2007, 10:13 PM   #7 (permalink)
Inactive
 
Join Date: 05-06-07
Posts: 85
iTrader: 0 / 0%
Latest Blog:
None

alainkun is a jewel in the roughalainkun is a jewel in the roughalainkun is a jewel in the roughalainkun is a jewel in the roughalainkun is a jewel in the roughalainkun is a jewel in the roughalainkun is a jewel in the rough
Send a message via MSN to alainkun
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

Its to rewrite all your URLS, to rewrite only some change rule. for example.

RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule /ccc/ddd http://example.com/ccc/dd/page1 [L,R=301]
alainkun is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
301 redirect tdd1984 SEO Forum 14 06-06-2007 11:48 PM
301 and 302 Redirect programmersbank SEO Forum 8 06-09-2006 01:57 PM
PHP Redirect Pimpen 2010 Coding Forum 12 06-14-2004 10:28 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 02:44 AM.
© Copyright 2008 V7 Inc