Mobile app version of vmapp.org
Login or Join
Frith620

: Redirect directory URL to instead have .html suffix htaccess redirect (301) all my old content from my WordPress to my new URL design. I want to redirect all the last trailing slashes to .html

@Frith620

Posted in: #301Redirect #Htaccess #Redirects #Wordpress

htaccess redirect (301) all my old content from my WordPress to my new URL design. I want to redirect all the last trailing slashes to .html ... the permalinks are already working, but I don't want to lose all my collected backlinks for which I worked so hard.

This is how my URLs look like:


Pages (old): /pages/redirection/ should redirect to /pages/redirection.html
Posts (old): /new-permalink/ should redirect to /news/new-permalink.html
Custom Posts /permalink/ should redirect to /projects/permalink.html


The following rewrite rule does not work for me. It ignores my rewritebase, so it redirects /projects/permalink/ to /permalink.html not to /projects/permalink.html.

RewriteEngine On
Options +FollowSymLinks
RewriteBase /project/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /project/index.php [L]
RewriteRule /project/([^/]*)/?$ /project/.html [L]

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Frith620

1 Comments

Sorted by latest first Latest Oldest Best

 

@Frith620

RewriteRule ^pages/([^/]*)/?$ pages/.html


Should do the trick.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme