Forum Moderators: phranque

Message Too Old, No Replies

Mod Rewrite for php forum

Mod Rewrite for php forum

         

DJRyan

5:46 am on Aug 14, 2004 (gmt 0)

10+ Year Member



Got this little issue...

www.oldwidgets.com was my old site

www.netwidgets.com is my new site (did a mod rewrite for the redirect on main urls and this works)

Here is what I need to do...

www.oldwidgets.com/forum/phpbb2/index.php redirecting to www.newwidgets.com/forum/phpbb2/index.php etc.

Here is the server code: .htaccess (root folder)

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^oldwidgets\.com [OR]
RewriteCond %{HTTP_HOST} ^www\.oldwidgets\.com
RewriteRule ^(.*)$ [newwidgets.com...] [R=permanent,L]

BTW - the above code works

In the forum folder i.e. /forum/phpbb2/ I have another .htaccess file as follows:

Options FollowSymLinks
RewriteEngine On
RewriteRule ^forums.* index.php
RewriteRule ^forum([0-9]*).* viewforum.php?f=$1&mark=topic
RewriteRule ^viewforum([0-9]*)-([0-9]*)-([0-9]*).* viewforum.php?f=$1&topicdays=$2&start=$3
RewriteRule ^forum([0-9]*).* viewforum.php?f=$1
RewriteRule ^ptopic([0-9]*).* viewtopic.php?t=$1&view=previous
RewriteRule ^ntopic([0-9]*).* viewtopic.php?t=$1&view=next
RewriteRule ^ftopic([0-9]*)-([0-9]*)-([a-zA-Z]*)-([0-9]*).* viewtopic.php?t=$1&postdays=$2&postorder=$3&start=$4
RewriteRule ^ftopic([0-9]*)-([0-9]*).* viewtopic.php?t=$1&start=$2
RewriteRule ^ftopic([0-9]*).* viewtopic.php?t=$1
RewriteRule ^ftopic([0-9]*).html viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5
RewriteRule ^sutra([0-9]*).* viewtopic.php?p=$1

The above works and is standard forum stuff that converts html to php - I don't think this is the issue.

I have a lot pages and do not want to 301 each line for each page I just want to do it in .htacess

Now the main point here is that the files are not located in different servers the locations above are the same i.e. [oldwidgets.com...] and [newwidgets.com...] are the same hence my problem.

I think this issue is effecting my serps due to duplication hence the need to find a solution ASAP.

Has anyone got any pointers? I have tried a few things (last one was go down the pub but when I got back it still did not work)

Many Thanks in advance!

jdMorgan

6:02 am on Aug 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



DJRyan,

Welcome to WebmasterWorld!

I don't understand the problem. The code you have at the top checks the requested domain name, and redirects all pages on oldwidgets to newwidgets. So, there can't be duplicate content, because all oldwidgets pages will now return a 301-Moved Permanently redirect, i.e. those oldwidget resources no longer exist as far as search engine spiders are concerned.


Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?oldwidgets\.com
RewriteRule ^(.*)$ http://www.newwidgets.com/$1 [R=permanent,L]

Jim

DJRyan

6:33 am on Aug 14, 2004 (gmt 0)

10+ Year Member



Him Jim,

The 301 redirects only the old domain but not any sub directories. (The forum folder)

Can I PM you with the links - the old link on the forum still shows up with Google Toolbar PR.

The new site also comes up but without PR - I thought the whole point of doing the 301 was that everything got redirected. This is not the case

jdMorgan

6:45 am on Aug 14, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If /forum is located under the same directory where your .htaccess code resides, then your code should redirect *everything* from oldwidgets to newwidgets as-is; The entire local url-path is backreferenced in the RewriteRule.

[added] Base your decision on whether the 301 redirect "is working" on the results you see in your browser address bar, not on what URLs show up in search engine results. You can also use the Server Headers [webmasterworld.com] checker. It will take from weeks to months for the search engines to update their databases as a result of a 301 redirect. [/added]

Jim