I’m trying (for almost all day now) to write rewritecond and rewriterule lines to redirect old indexed and ranked pages to the new friendly permalinks (wordpress site). But I’m doing something wrong; been googling but can’t find the right answer.
( assuming Apache 2.x. If it’s 1.x change ^ to ^/ )
A few comments on the rest of the code if I may:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Find out once if mod_rewrite works on your server, and if it does remove <IfModule mod_rewrite.c> and </IfModule>
Right now you’re asking Apache for every request is mod_rewrite is enabled, which not necessary if you know it is.
You don’t have any Redirect* directive in your .htaccess, so you can get rid of the RewriteBase /
Change /index.php to just index.php, i.e., remove the leading slash. With the leading slash Apache will first look in the root of the filesystem to see if there is an index.php there. Only when it finds there isn’t one will it look for index.php in your document root.
(so it is sticking the original Query_string to it).
Can we get rid of the query string? I don’t want google to think there are 2 different pages.
I had already read your comment on the “ifmodule” lines, but I wanted it to work before changing things in 2 places and wondering what might cause what problem
Can you explain that to me? We’ve got a match in the preceeding rewritecond
and it was working but got the extra query. But why do we need the “.” now instead of the “^info/?”.
Is there a place where I could have found more of these extras (the appening “?”) explained?
You really shouldn’t be needing that dot. That way it will redirect everything that has page_id=1 in the query string to /tools. So not just /info/?page_id=1 , but also /test/?page_id=1 , /bla/?page_id=1 , etc
Which is why I suggested ^info/?$
If that doesn’t work you may be on Apache 1.x, in which case you’d need to make it ^/info/?$.