Welcome to WebmasterWorld Guest from 107.21.163.40

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Migration Dotclear Wordpress and .htaccess

Migration Dotclear Wordpress and .htaccess

     
1:11 pm on Feb 25, 2010 (gmt 0)

New User

5+ Year Member

joined:Feb 25, 2010
posts: 7
votes: 0


Hi,

I'm migrating my blog from dotclear to Wordpress.

The URL used to be:
www.domain.com/?my-title
With WP, I have:
www.domain.com/my-title

How can I silently 301 redirect the first one to the second one ? I tried many .htaccess in my current settings (dotclear is in one folder, wp in a different one), but nothing I did worked...

Thanks in advance
4:31 pm on Feb 25, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


You should not do this "silently," or you will end up with a bunch of old URLs floating around in search results and the files for those old URLs will also be accessible using new URLs. This is duplicate-content, and will negatively affect your search engine rankings for those files/threads/posts.

I suggest that you externally redirect all old URLs to their corresponding new URLs to avoid this.

Please post your code as a starting point for further discussion.

Thanks,
Jim
3:52 am on Feb 28, 2010 (gmt 0)

New User

5+ Year Member

joined:Feb 25, 2010
posts: 7
votes: 0


Thanks for your reply.
What do you mean by "externally" ?

I don't know which code you need... The only thing I have is the DC engine, the WP engine and the .htaccess - which is now forcing the "www". Nothing else :(

Thanks
8:23 am on Feb 28, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


In .htaccess use RewriteRule to externally 301 redirect all direct client requests for the old URLs. This will cause the browser, and searchengines, to make a new request for the new URL.

'Silently' implies an internal rewrite, which means that the old and new URL both continue to return '200 OK' meaning that both URLs continue to be indexed. You need to avoid that - only the new URLs should be indexed.
8:55 am on Feb 28, 2010 (gmt 0)

New User

5+ Year Member

joined:Feb 25, 2010
posts:7
votes: 0


Ok I mixed up 301 & the meaning of silently...

Now how can I write this .htaccess ? I tried many different things, none of them worked. I always got the question mark.

Any help on that ?

Thanks a lot
10:21 am on Feb 28, 2010 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 19, 2004
posts:53
votes: 0


Have you tried the Wordpress Redirection plugin?
[wordpress.org...]
10:39 am on Feb 28, 2010 (gmt 0)

New User

5+ Year Member

joined:Feb 25, 2010
posts: 7
votes: 0


Yes I did. Nothing this kind of redirection though...
4:19 pm on Mar 1, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


We cannot write your code for you here -- This forum is global in reach, and we don't have enough volunteer contributors to keep up with that kind of "support." We are a discussion forum, not a free "help desk."

After reviewing the resources cited in our Apache Forum Charter, looking through our Apache Forum Library, and using the WebmasterWorld site search facilities to find related previous threads, please post your best attempt at coding a solution as a basis for on-going discussion. Links to these resources are at the top of this page.

Thanks,
Jim
7:33 pm on Mar 2, 2010 (gmt 0)

New User

5+ Year Member

joined:Feb 25, 2010
posts: 7
votes: 0


I tried:
RewriteCond $1 ^dotclear/
RewriteCond %{QUERY_STRING} .
RewriteRule (.*) http://www.example.com/wordpress/$1? [R=301,L]

To try to redirect from the old one to the new one. Nothing is happening at all.

I also tried
Redirect permanent /dotclear/? http://www.example.com/wordpress
but that doesn't sound good - nothing is happening either anyway.

I tried to stay in the same directoy - which is my main goal here, and redirect
/dir/?title to /dir/title without pointing to anything else.
It's not taking it either :-/

Whatever I tried never had any effect - or I got a 500 error page.
Thanks
11:59 pm on Mar 2, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
posts:18903
votes: 0


RewriteRule cannot directly see the query string.

Capture the QUERY_STRING value in a RewriteCond as a backreference and use that %1 value for the redirect target using a RewriteRule and [R=301,L] as before.

Be careful that the rule doesn't try to redirect all URL requests. Limit the pattern to not match image, CSS, JS, robots.txt, SE verification files, and so on, requests.
6:27 am on Mar 4, 2010 (gmt 0)

New User

5+ Year Member

joined:Feb 25, 2010
posts:7
votes: 0


Isn't it what those lines are doing ?
RewriteCond %{QUERY_STRING} .
RewriteRule (.*) http://www.example.com/wordpress/$1? [R=301,L]

I also have to exclude the static files, but at least I should first get some results...
8:41 pm on Mar 4, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


According to the description in your first post, you'd want:

RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^$ http://www.example.com/%1? [R=301,L]

example.com/?foo --301--> example.com/foo

Do you have any working mod_rewrite rules? If not, then either both of these lines or only the second line will be required ahead of the code above; You will have to test one or both, because it depends on your server configuration:

Options +FollowSymLinks -Indexes -MultiViews
RewriteEngine on

Delete your browser cache after making any change to your server-side code.

Jim
1:47 pm on Mar 5, 2010 (gmt 0)

New User

5+ Year Member

joined:Feb 25, 2010
posts:7
votes: 0


Wow, Google will love this so much !

So this is my new .htaccess:

Options +FollowSymLinks -Indexes -MultiViews
RewriteEngine on
RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^$ http://www.example.com/folder/%1? [R=301,L]


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteBase /folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /folder/index.php [L]
</IfModule>
# END WordPress

Inside the folder.
At the root, I redirect to (www) if there's no subdomain.

Thanks a lot for your help !