PDA

View Full Version : 301 redirect - need help please..


Yellow Slider
07-09-2007, 03:31 PM
I need to 301 redirect like that -
www.domain.com/dir/index.php

will be redirected to

www.anotherdomain.com/index.php

and all the other pages as well,
for example
www.domain.com/dir/forumdisplay.php?f=92

will 301 redircet to
www.anotherdomain.com/forumdisplay.php?f=92
and all the posts and threads as well..

thanks a lot for the help.

Dismounted
07-10-2007, 05:18 AM
You should be able to create redirects using your hosting control panel (ie. cPanel, Plesk, etc.).

Yellow Slider
07-10-2007, 06:00 AM
not this types of redirects.
i can do just basic redirect with my DA server panel.

Dismounted
07-10-2007, 06:07 AM
What do they put into the .htaccess file?

Eikinskjaldi
07-10-2007, 06:24 AM
I need to 301 redirect like that -
www.domain.com/dir/index.php

will be redirected to

www.anotherdomain.com/index.php

and all the other pages as well,
for example
www.domain.com/dir/forumdisplay.php?f=92

will 301 redircet to
www.anotherdomain.com/forumdisplay.php?f=92
and all the posts and threads as well..

thanks a lot for the help.

I haven't tested this, but try putting this into your .htaccess file


RewriteEngine On
RewriteRule www\.domain\.com/dir/(.*) www.anotherdomain.com/$1

Yellow Slider
07-10-2007, 07:06 AM
it doesn't work , at all, it isn't redirecting thanks for trying,
can you please try giving me another code to try? it's very urgent.

thanks.

Eikinskjaldi
07-10-2007, 07:52 AM
it doesn't work , at all, it isn't redirecting thanks for trying,
can you please try giving me another code to try? it's very urgent.

thanks.

Nope, sorry, thats all I got. If that doesn't work, my next suggestion would be to "play around with it"


I am not sure what format .htaccess receives requests, I do all my rewriting in httpd.conf.

maybe it doesnt get the domain name?

try
RewriteRule dir/(.*) http://otherdomain.com/$1

Yellow Slider
07-10-2007, 10:49 AM
I can rewrite httpd.conf, what do i need to add \ edit?

vB Nova
07-10-2007, 10:58 AM
Options +FollowSymLinks
RewriteEngine on
RewriteRule dir/(.*) http://www.newdomain.com/$1 [R=301,L]

Have Phun :)

cyberphr
07-10-2007, 11:08 AM
Don't you mean 401?

Dismounted
07-10-2007, 11:41 AM
It's 301 (Permanently Moved). You're probably thinking of 404 (Page Not Found)?

Yellow Slider
07-10-2007, 12:13 PM
Nope, I'm thinking on 301,
I have 2 forums, and one of then is located in a directory, i'm moving it to it's own domain (it's about time.. )

and the code isn't working (VB NOVA)
can it be because i have another htaccess file in the root folder? cous nothing had happened :

vB Nova
07-10-2007, 12:17 PM
Yeah, you can merge the two files or if you don't know how/think you'll mess something up. Paste the other one here and I'll do it.

Yellow Slider
07-10-2007, 12:20 PM
this is the root folder htaccess file
RewriteEngine On


RewriteEngine On
RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]
RewriteCond %{REQUEST_FILENAME} (admincp|modcp|clientscript|cpstyles|images)
RewriteRule ^(.*)$ $1 [L]


# SEO Videos
# https://vborg.vbsupport.ru/showthread.php?p=1117273

# ofcourse you can rename videos.html and make it for example a non existing directory /videos/ and /videos/videoindex-20.xhtml etc.

RewriteCond %{HTTP_HOST} !^www\.atraf-f\.net
RewriteRule (.*) http://www.atraf-f.net/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos\.html&page=([0-9]+)$ http://www.atraf-f.net/videos-page$1.html [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos\.html$ index.php?videos=1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos-page([0-9]+)\.html$ index.php?videos=$1 [L]



there is a board in the base domain, in a directory inside the base domain there is another board , and i want to redirect the files in the directory to a new domain (on the same server..)

thanks a lot :)

vB Nova
07-10-2007, 03:16 PM
Options +FollowSymLinks
RewriteEngine on

RewriteRule /upload/(.*) http://www.atraf-f.net/$1

RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_FILENAME} (admincp|modcp|clientscript|cpstyles|images)
RewriteRule ^(.*)$ $1 [L]

RewriteCond %{HTTP_HOST} !^www\.atraf-f\.net
RewriteRule (.*) http://www.atraf-f.net/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos\.html&page=([0-9]+)$ http://www.atraf-f.net/videos-page$1.html [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos\.html$ index.php?videos=1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos-page([0-9]+)\.html$ index.php?videos=$1 [L][R=301,L]

Yellow Slider
07-10-2007, 03:22 PM
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

:\

vB Nova
07-10-2007, 03:24 PM
Options +FollowSymLinks
RewriteEngine on

RewriteRule ^upload/(.*)$ http://www.atraf-f.net/$1

RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_FILENAME} (admincp|modcp|clientscript|cpstyles|images)
RewriteRule ^(.*)$ $1 [L]

RewriteCond %{HTTP_HOST} !^www\.atraf-f\.net
RewriteRule (.*) http://www.atraf-f.net/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos\.html&page=([0-9]+)$ http://www.atraf-f.net/videos-page$1.html [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos\.html$ index.php?videos=1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos-page([0-9]+)\.html$ index.php?videos=$1 [L][R=301,L]


If that doesn't work try:
Options +FollowSymLinks
RewriteEngine on

RewriteRule ^upload\/(.*)$ http://www.atraf-f.net/$1

RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_FILENAME} (admincp|modcp|clientscript|cpstyles|images)
RewriteRule ^(.*)$ $1 [L]

RewriteCond %{HTTP_HOST} !^www\.atraf-f\.net
RewriteRule (.*) http://www.atraf-f.net/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos\.html&page=([0-9]+)$ http://www.atraf-f.net/videos-page$1.html [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos\.html$ index.php?videos=1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos-page([0-9]+)\.html$ index.php?videos=$1 [L][R=301,L]

Yellow Slider
07-10-2007, 06:30 PM
it redirects, but not in a good way, it lets me browse the forum like if the forum is located in the folder, instead moving me to the same path at the other domain :\

please try to help me..

vB Nova
07-10-2007, 06:46 PM
What's the first domain so I can see & what code did you use, the first or the second?

Yellow Slider
07-10-2007, 08:48 PM
both of them are doing the same thing,
the basic domain is
http://www.atraf-f.net
and the board that is located in http://www.atraf-f.net/upload (i've uploaded this board just to check the script) the real board is in an other directory..
it now has
RewriteRule ^upload\/(.*)$ http://www.atraf-f.net/$1

vB Nova
07-11-2007, 11:03 AM
You removed the [R=301,L] :p
Options +FollowSymLinks
RewriteEngine on

RewriteRule ^upload\/(.*)$ http://www.atraf-f.net/$1 [R=301,L]

RewriteRule ^((urllist|sitemap).*\.(xml|txt)(\.gz)?)$ vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 [L]

RewriteCond %{REQUEST_FILENAME} (admincp|modcp|clientscript|cpstyles|images)
RewriteRule ^(.*)$ $1 [L]

RewriteCond %{HTTP_HOST} !^www\.atraf-f\.net
RewriteRule (.*) http://www.atraf-f.net/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos\.html&page=([0-9]+)$ http://www.atraf-f.net/videos-page$1.html [L,R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos\.html$ index.php?videos=1 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^videos-page([0-9]+)\.html$ index.php?videos=$1 [L][R=301,L]

Yellow Slider
07-11-2007, 01:42 PM
Thanks a lot :D !!

vB Nova
07-11-2007, 05:14 PM
No Problem, Enjoy!.