0

I need to rewrite an url like /services/rental/faq-2/ so that the user (and robots) see /services/rental/faq/

This is my current .htaccess (it's Wordpress) with no successful rewrite:

# 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]
RewriteRule ^/services/rental/faq/?$ /services/rental/faq-2/ [NC,L]
</IfModule>

# END WordPress

Any of the hints I searched actually worked, maybe rule order is important or (most probable) I have no idea on how to do it

K. Weber
  • 2,643
  • 5
  • 45
  • 77

1 Answers1

0

Your external URL is /services/rental/faq[/]. This is the one produced by links in your pages, and is the one robots and users see. It is NOT produced by .htaccess -- .htaccess only sees incoming URIs.

Try moving your new RewriteRule up before all the other WordPress RewriteRules (after the RewriteBase).

Phil Perry
  • 2,126
  • 14
  • 18
  • Doesn't work, it takes me to another page `/services/guides/faq/` maybe it's a Wordpress internal problem as it seems that _slug_ (`faq`) must be unique – K. Weber Apr 22 '14 at 08:38
  • 1
    You're saying that `/services/rental/faq/` gets rewritten to `/services/guides/faq/`? That would have to be something internal to WP, if all you did was move that one RewriteRule up to the top. Sorry, can't help you with that issue. – Phil Perry Apr 22 '14 at 13:15