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
jdMorgan
4:31 pm on Feb 25, 2010 (gmt 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
djoh
3:52 am on Feb 28, 2010 (gmt 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
g1smd
8:23 am on Feb 28, 2010 (gmt 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.
djoh
8:55 am on Feb 28, 2010 (gmt 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
harbs
10:21 am on Feb 28, 2010 (gmt 0)
Have you tried the Wordpress Redirection plugin? [wordpress.org...]
djoh
10:39 am on Feb 28, 2010 (gmt 0)
Yes I did. Nothing this kind of redirection though...
jdMorgan
4:19 pm on Mar 1, 2010 (gmt 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.
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
g1smd
11:59 pm on Mar 2, 2010 (gmt 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.
djoh
6:27 am on Mar 4, 2010 (gmt 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...
jdMorgan
8:41 pm on Mar 4, 2010 (gmt 0)
According to the description in your first post, you'd want:
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.