I have a wordpress site up and it's been up for a while. Recently I was asked to change the URL of one of the pages.

The current URL is:


They want the URL of that page to be:


However, I can't alter that original URL nor any of the other URLs on the site. I was trying to write a rewrite rule in the .htaccess file, but I can't get it to display anything other than a 404 page.

Here's the htaccess file:

RewriteEngine On

RewriteRule ^news/?$ index.php?category_name=newsroom [L]

RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

I've tried moving it around in the order of things. I've tried adding the "[PT]" flag instead of the "[L]" flag.

Can anyone help?

  • You should consider requesting migration to Stack Overflow. How is this WordPress related? Commented Sep 17, 2014 at 20:02
  • 1
    Because I was looking for a Wordpress solution
    – Commodore Timo
    Commented Sep 17, 2014 at 20:25

1 Answer 1


I was able to get this to work by doing 3 things differently:

  1. I removed the rule from the .htaccess file
  2. I added a "add_rewrite_rule" function in the functions.php file
  3. Rather than using "category_name" I reverted to using "cat" as the parameter

Here's the code:

function rewrites() {
   add_rewrite_rule('^news?$', 'index.php?cat=6', 'top');
add_action('init', 'rewrites');
  • I think something like this would need to be implemented within WordPress (as you have done). The best you'd be able to implement in .htaccess alone would be an external redirect (I think). (Although in some ways, a redirect would be preferable as it avoids duplicate content - maintaining the canonical URL. I wonder how this is achieved with the WordPress solution?)
    – MrWhite
    Commented Jun 6, 2017 at 22:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.