Reputation: 4461
I have troubles with mod_rewrite.
I have wordpress site located in 'wp' directory. It is accessible as http://localhost/wp/
There is page http://localhost/wp/sample-page/
on the site.
I want to make this page open with url http://localhost/wp/sample-page-2/
without redirect.
Here is what in .htaccess file:
RewriteEngine On
RewriteBase /wp/
RewriteRule ^sample-page-2/$ sample-page/ [L]
But I'm getting 404 error.
Could somebody explain me what I'm doing wrong? Thanks in advance.
UPD:
@soju: Well, "sample-page-2" - is just example
http://localhost/wp/sample-page/section/
. And this rule RewriteRule ^sample-page/section/$ sample-page/ [L]
didn't work. Then I decided to "simpliyfy" url("sample-page-2" instead of "sample-page/section") - no success.UPD2
BTW, redirect RewriteRule ^sample-page-2/$ sample-page/ [R=301,L]
works
Upvotes: 0
Views: 507
Reputation: 25312
I suppose wordpress rewrite rules are after your own rule, so you should remove [L]
option to let wordpress handle sample-page
url
EDIT about UPD2 : Well, it works with a 301 redirection, but you said you don't want redirection ?
You can add a filter on rewrite_rules_array
to make your own rewrite rule, take a look at example on codex : http://codex.wordpress.org/Class_Reference/WP_Rewrite#Examples
Upvotes: 1