I have redeveloped a static html site in wordpress and am trying to map previous page address to the new wordpress compatible slugs using the htaccess file.
So I have figured out how to remove the ".html" of a requested url but also need to remove the remove the final “/”.
ie change "fred/fred1/fred2.html" to become "fred/fred1fred2" ...
Thanks for any suggestions...
Currently have:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} \.html$
RewriteRule ^(.*)\.html$ $1 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
You should replace this:
"RewriteRule ^(.*)\.html$ $1 [R=301,L]"
by this :
"RewriteRule ^(.*)\/(.*)\.html$ $1$2 [R=301,L]"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.