Andrei RRR
Andrei RRR

Reputation: 3162

.htaccess 301 redirect

I switched my website from MODx to Wordpress to a different platform so now I have to make a 301 redirect.

All I need to do is to 301 Redirect http://www.domain.com/page-name.html to http://www.domain.com/page-name/.

What lines should I add to my Wordpress .htaccess file?

.htaccess file

# 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

Upvotes: 0

Views: 1226

Answers (2)

Mikeys4u
Mikeys4u

Reputation: 1552

Be aware the full URL does not work, only use the relative URL

Upvotes: 0

Jon Lin
Jon Lin

Reputation: 143946

For just one page, try:

Redirect 301 /page-name.html /page-name/

For everything ending with html, try:

RedirectMatch 301 ^/([^.]+)\.html$ /$1/

Upvotes: 3

Related Questions