.htaccess redirect from generic .html link to .php?
-
I moved my blog from MT to WP and was able to preserve the permalink structure:
Old MT permalinks: “domain.com/archives/001234.html”
New WP permalinks: “domain.com/archives/001234.php”
But I have not succeeded in creating an htaccess redirect so that people who find a link to one of my old MT posts on Google are automatically sent to the php version of that link. I also want to redirect Google links to my old blog’s MT comments, which take the form “domain.com/archives/001234.html#005678”, to “domain.com/archives/001234.php” (i.e., I want the comment ID string to be stripped from the URL, and the URL then converted to php format).
My current .htaccess file (which doesn’t work for html-to-php redirection) is:
code
/code
<IfModule mod_rewrite.c>
RewriteEngine On
# WordPress rules: redirect not-found file or directory to index.php.
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# Redirect any .html page to the corresponding .php page.
RewriteRule ^(.*).html$ $1.php [L]
</IfModule>
I’d be grateful if anyone could show me how to perform the generic htaccess redirects I’m asking about. Thanks.
- The topic ‘.htaccess redirect from generic .html link to .php?’ is closed to new replies.