Reputation: 1478
I need to rewrite url where the url is:
http://www.domainname.co.uk/blog/gallery/gallery2 --> URL1
which need to be
http://www.domainname.co.uk/gallery/gallery2 ---> URL2
where http://www.domainname.co.uk/blog is a directory with wordpress installed. Now when i enter URL2 it should show the content of URL1. Is it possible? I just need to remove the word blog.
-----------my .htaccess---------
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteRule ^(gallery/.+)$ /blog/$1 [L,NC]
</IfModule>
Upvotes: 0
Views: 201
Reputation: 1139
Edited:
You can do use the rewrite rule as follows if you are using index.php in root folder where htaccess resides.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(gallery/.+)$ /blog/$1 [L,NC]
RewriteRule ^gallery$ http://www.domainname.co.uk/blog/gallery/1$ [L,P]
RewriteRule . /index.php [L]
</IfModule>
Upvotes: 1