943,840 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1896
  • PHP RSS
Sep 22nd, 2009
0

301 Rediret Help

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
wickedsunny is offline Offline
96 posts
since Oct 2008
Sep 22nd, 2009
1

Re: 301 Rediret Help

Something like this:

RewriteRule "^photo/(.*)$" "http://www.linkzdirect.com/art/$1" [R=301,L]
Sponsor
Featured Poster
Reputation Points: 550
Solved Threads: 729
Bite my shiny metal ass!
pritaeas is offline Offline
4,176 posts
since Jul 2006
Sep 22nd, 2009
0

Re: 301 Rediret Help

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
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
wickedsunny is offline Offline
96 posts
since Oct 2008
Sep 23rd, 2009
0

Re: 301 Rediret Help

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
Sponsor
Featured Poster
Reputation Points: 550
Solved Threads: 729
Bite my shiny metal ass!
pritaeas is offline Offline
4,176 posts
since Jul 2006
Sep 23rd, 2009
0

Re: 301 Rediret Help

yup thts wht i want. sweet thx let me try if that works and thanks for the tut link
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
wickedsunny is offline Offline
96 posts
since Oct 2008
Sep 23rd, 2009
0

Re: 301 Rediret Help

hey again. nop didnt worked getting a 500 server error. Want me to share teh full .htaccess file?
Regards
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
wickedsunny is offline Offline
96 posts
since Oct 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: advice from thesis
Next Thread in PHP Forum Timeline: Array Problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC