2022-10-22

Wordpress htaccess redirect: redirect all pages except home to /content/ [closed]

I have a website running on wordpress and for seo reasons and other requirements I'm trying to create a htaccess 301 redirection from 'mysite.com/pages-names/' to 'mysite.com/content/pages-names'.

This redirection should affect all public pages and posts except the homepage (the homepage should be at 'mysite.com') and the wp-admin dashboard (the login / dashboard should be like always is at /wp-admin/). So the final structure should be like this:

  • mysite.com: homepage
  • mysite.com/content/'pages or posts': the rest of the website
  • mysite.com/wp-admin/: dashboard

Currently i'm using the default wordpress pretty permalink htaccess rules:

< IfModule mod_rewrite.c >
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
< /IfModule >

Thanks in advance.



No comments:

Post a Comment