Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Reply
 
Thread Tools Display Modes
Share |
  #1  
Old 06-04-2007, 08:16 PM
modine modine is offline
Junior Member
 
Join Date: 06-04-07
Posts: 8
iTrader: 0 / 0%
.htaccess 301 redirect

Hi,

I need to redirect over one hundred pages to a new directory but can not find the right code. Could someone please help me. Everything I've done so far doesn't work only make the site unavailable all together.

Thanks,
modine
 
Reply With Quote

Advertisement

Advertisement

  #2  
Old 06-04-2007, 09:34 PM
lordspace's Avatar
lordspace lordspace is offline
Contributing Member
 
Join Date: 05-30-06
Location: Canada
Posts: 913
iTrader: 0 / 0%
how your pages look like ?
e.g. page1, page2 ?

I have a script that redirects to different links but you have to make the mappings.
 
Reply With Quote
  #3  
Old 06-04-2007, 09:39 PM
modine modine is offline
Junior Member
 
Join Date: 06-04-07
Posts: 8
iTrader: 0 / 0%
Quote:
Originally Posted by lordspace View Post
how your pages look like ?
e.g. page1, page2 ?

I have a script that redirects to different links but you have to make the mappings.
what do you mean... how do my pages look
 
Reply With Quote
  #4  
Old 06-04-2007, 10:37 PM
lordspace's Avatar
lordspace lordspace is offline
Contributing Member
 
Join Date: 05-30-06
Location: Canada
Posts: 913
iTrader: 0 / 0%
what are you pages - PHP files ?
how do they look e.g.
http://domain.com/page4redirect.html -> http://domain.com/new/page4.html
http://domain.com/page4redirect.php -> http://domain.com/new/page5.html
 
Reply With Quote
  #5  
Old 06-04-2007, 10:57 PM
modine modine is offline
Junior Member
 
Join Date: 06-04-07
Posts: 8
iTrader: 0 / 0%
Quote:
Originally Posted by lordspace View Post
I got the redirect to work for the one site. However now all pages including a couple other websites get redirected to this site, even though they're are not coming from the directory I'm redirecting. Any ideas on this?

modine
 
Reply With Quote
  #6  
Old 06-04-2007, 11:16 PM
lordspace's Avatar
lordspace lordspace is offline
Contributing Member
 
Join Date: 05-30-06
Location: Canada
Posts: 913
iTrader: 0 / 0%
would you paste contents of your .htaccess ?
 
Reply With Quote
  #7  
Old 06-05-2007, 07:06 PM
modine modine is offline
Junior Member
 
Join Date: 06-04-07
Posts: 8
iTrader: 0 / 0%
here's the code

IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*

<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName www.domain.com
AuthUserFile /www3/domain/_vti_pvt/service.pwd
AuthGroupFile /www3/domain/_vti_pvt/service.grp

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]

Redirect 301 /store2/ http://www.domain.com/
 
Reply With Quote
  #8  
Old 06-05-2007, 08:31 PM
lordspace's Avatar
lordspace lordspace is offline
Contributing Member
 
Join Date: 05-30-06
Location: Canada
Posts: 913
iTrader: 0 / 0%
Put that below "RewriteCond"
RewriteCond %{REQUEST_URI} !somefile.php [NC] # we skip links containing somefile.php
 
Reply With Quote
  #9  
Old 06-05-2007, 08:41 PM
modine modine is offline
Junior Member
 
Join Date: 06-04-07
Posts: 8
iTrader: 0 / 0%
thanks but can you explain a little more because i'm really am not sure what i'm doing. i don't know what you mean when you say put that below. that below what?
 
Reply With Quote
  #10  
Old 06-05-2007, 10:11 PM
lordspace's Avatar
lordspace lordspace is offline
Contributing Member
 
Join Date: 05-30-06
Location: Canada
Posts: 913
iTrader: 0 / 0%
when I put "!" in front of the file, this file gets excluded from mod_rewrite and there will be no redirect for it.
 
Reply With Quote
  #11  
Old 06-05-2007, 10:28 PM
modine modine is offline
Junior Member
 
Join Date: 06-04-07
Posts: 8
iTrader: 0 / 0%
thank you but i'm still not sure how to input it. where you have somefile - do i replace that with a file? also what about the php, i don't believe any of my files are php files. i've been working on this for 2 days now and i am getting tired. seems like i'll never get it working.
 
Reply With Quote
  #12  
Old 06-05-2007, 10:39 PM
lordspace's Avatar
lordspace lordspace is offline
Contributing Member
 
Join Date: 05-30-06
Location: Canada
Posts: 913
iTrader: 0 / 0%
first, when you say that something is not working please give some details and even more examples.
Tell me what you expect to happen and then what really happens.

We, programmers, need as much info as possible because sometimes there are a lot of possible issues that may cause things not to work.
This is only my opinion and a little piece of advice.
 
Reply With Quote
  #13  
Old 06-05-2007, 10:54 PM
modine modine is offline
Junior Member
 
Join Date: 06-04-07
Posts: 8
iTrader: 0 / 0%
it's hard to explain but here goes. i have 3 websites under the same root folder, just the other day i decided to move the files from the store2 folder to under the root folder and i did the redirect so visitors could find my site from old links online. this all works fine. 2 of the other folders under the root folder are separate domains that when typed in the address bar should bring the site in, however it's redirecting them to the first site since i made these changes. i'm not sure if it happened before the .htaccess was changed or because i moved files from store2 folder to the root. the site that's redirect correctly is watersportsproducts.com the 2 that are not coming in and are being redirect to watersportsproducts are johnkhadivi.com and westcoastmall.com. let me know if you need any more info and thanks again. modine
 
Reply With Quote
  #14  
Old 06-12-2007, 12:11 AM
alainkun alainkun is offline
Contributing Member
 
Join Date: 05-06-07
Posts: 84
iTrader: 0 / 0%
If you have diferent folders for each webpage you should add one .htaccess for each webpage. the oldest one folder have to redirect with .htaccess to the news one.
 
Reply With Quote
  #15  
Old 06-12-2007, 11:28 AM
modine modine is offline
Junior Member
 
Join Date: 06-04-07
Posts: 8
iTrader: 0 / 0%
Thank you for your response. I have it working.

modine
 
Reply With Quote
Go Back   Webmaster Forum > Web Development > 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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
htaccess 301 redirect esiason14 Coding Forum 2 01-31-2007 12:44 PM
.htaccess redirect problem..! Immo Coding Forum 16 08-03-2006 04:02 AM
.htaccess redirect question Pimpen 2010 Coding Forum 4 04-04-2006 10:34 AM
htaccess/mod rewrite help to redirect subdomain to a domain Thanol Coding Forum 0 07-19-2004 09:36 AM
.htaccess redirect to new webspace luchtzak Coding Forum 7 01-25-2004 09:56 AM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 02:27 AM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC