Issue redirecting ‘blog’ to ‘news’ in WordPress using .htaccess

OK, so here’s the solution that works for me… <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^blog/(.*) news/$1 [L,R=301] </IfModule> # 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 Thanks again to @WebElaine for the input!

Creating a copy of a website in a subdirectory, wp-admin redirect problem

If it’s a standard WordPress .htaccess file that won’t be your problem. I’m willing to bet you forgot to change the Site URL values when you imported the database. You can either edit it in the options table in your database or even in your wp-config file by adding define(‘WP_HOME’, ‘http://mainwebsite.com/test’); define(‘WP_SITEURL’, ‘http://mainwebsite.com/test’); to it. … Read more

.htaccess rewriterule being ignored – tyring to remove dates from WP posts

You can actually change them in Settings -> Permalinks and it will change the link that generated for the post. And if you still be unhappy with result you can remove WordPress rewrite rules for dates with date_rewrite_rules filter. UPDATE: In this case, you can use post_rewrite_rules to keep the date to post rule working … Read more

Prevent wordpress autoredirect

Not really a WP-specific question, but I’ll help you out. That regex will match ex.com/helloworld/ but not ex.com/helloworld. To handle both you’d want RewriteRule ^helloworld/?$ /careers/helloworld-recruiting/ [L,R=301] The question mark makes the preceding token optional and the single slash rather than double in the rewritten URL makes it relative to the root.

How do I do a redirect to WordPress permalink with post id via htaccess?

So I’m not sure why that RewriteRule returned a 404 error for you, because I’ve tested it and it did work as expected — if permalinks are actually enabled, you would be redirected to the actual post permalink. And here’s the content of my .htaccess file: RewriteEngine On RewriteRule ^go/(\d+)$ /?p=$1 [R=302,L] # BEGIN WordPress … Read more