301 Rediret Help

Reply

Join Date: Oct 2008
Posts: 89
Reputation: wickedsunny is an unknown quantity at this point 
Solved Threads: 4
wickedsunny wickedsunny is offline Offline
Junior Poster in Training

301 Rediret Help

 
0
  #1
Sep 22nd, 2009
hello everyone.
im using a cms and i have just changed the strucutre of my site's url making changes in the core files.

here is an example what i have done.
at first urls were:
http://www.linkzdirect.com/photo/gallery/picture-name

now they are chagned to :
http://www.linkzdirect.cm/art/gallery/picture-name

everything seems to be working fine. i also made these chagnes in .htacess. works fine.

but a large number of my site's pages are indexed in google and other engines and i get traffic from that. so is there a way i can put a redirect code in .htacccess and it will redireect all the url containing photo/gallery/ to art/gallery/

here is a little example of code written in my .htaccess.
RewriteRule ^art/all/([0-9]+)/([0-9]+)/{0,1}$ browsePhoto.php?page=$2&per_page=$1 [QSA,L]
RewriteRule ^art/gallery_top/{0,1}$ browsePhoto.php?rate=top [QSA,L]

At First Art word was as Photo.
Help is Apprecited.
thanks in advance.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 838
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 136
Sponsor
pritaeas's Avatar
pritaeas pritaeas is online now Online
Practically a Posting Shark

Re: 301 Rediret Help

 
1
  #2
Sep 22nd, 2009
Something like this:

RewriteRule "^photo/(.*)$" "http://www.linkzdirect.com/art/$1" [R=301,L]
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 89
Reputation: wickedsunny is an unknown quantity at this point 
Solved Threads: 4
wickedsunny wickedsunny is offline Offline
Junior Poster in Training

Re: 301 Rediret Help

 
0
  #3
Sep 22nd, 2009
hey man thank u so much it worked like a charm , im really grateful to u .
there is one more thing i would like to ask
i have also changed the profiles from www.linkzdirect.com/username to uesrname.linkzdirect.com by wildcard dns and blah blah blah it works like a charm but i still hvent been able to figure out a 301 redirect for it as well.

here is the original code.:
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .+ - [L]
RewriteRule ^([A-Za-z0-9_-]+)$ profile.php?ID=$1 [QSA,L]

its replaced to :

RewriteCond %{HTTP_HOST} ^([^w]{3}.*).linkzdirect.com$
RewriteRule ^$ /profile.php?ID=%1 [QSA,L]
RewriteCond %{HTTP_HOST} ^([^w]{3}.*).linkzdirect.com$
RewriteRule ^/(.+)$ /$1 [QSA,L]

so i would really really apprecite man if u can guide me in this as wel. plus i need to learn .htaccess redirect can u give me a good tutorial link to.
thanks again bro
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 838
Reputation: pritaeas will become famous soon enough pritaeas will become famous soon enough 
Solved Threads: 136
Sponsor
pritaeas's Avatar
pritaeas pritaeas is online now Online
Practically a Posting Shark

Re: 301 Rediret Help

 
0
  #4
Sep 23rd, 2009
do you mean you want to redirect e.g. www.linkzdirect.com/pritaeas to pritaeas.linkzdirect.com ? Something like this perhaps ?

RewriteCond %{HTTP_HOST} ^www.linkzdirect.com$
RewriteRule ^(\w+)$ http://$1.linkzdirect.com [301,L]

Docs:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html
"If it is NOT source, it is NOT software."
-- NASA
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 89
Reputation: wickedsunny is an unknown quantity at this point 
Solved Threads: 4
wickedsunny wickedsunny is offline Offline
Junior Poster in Training

Re: 301 Rediret Help

 
0
  #5
Sep 23rd, 2009
yup thts wht i want. sweet thx let me try if that works and thanks for the tut link
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 89
Reputation: wickedsunny is an unknown quantity at this point 
Solved Threads: 4
wickedsunny wickedsunny is offline Offline
Junior Poster in Training

Re: 301 Rediret Help

 
0
  #6
Sep 23rd, 2009
hey again. nop didnt worked getting a 500 server error. Want me to share teh full .htaccess file?
Regards
Reply With Quote Quick reply to this message  
Reply

Tags
301, htaccess, redirect, url

Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC