views:

74

answers:

2

Hello!

I want to do a simple re write

from

http://www.example.com/iran/iran/province/Yazd

to

http://www.example.com/iran/province/Yazd

This is a codeigniter app that i have put in 'iran' folder. The class name is Iran that is why there are 2 'iran' after each other. I've managed to remove my codeigniter 'index.php' from the url with rewrite

 RewriteRule ^(.*)$ iran/index.php?/$1 [L]
+2  A: 

Try adding a Rewritebase to the .htaccess in your iran folder.

RewriteBase   /iran

Then replace your rewrite to

RewriteRule ^(.*)$ index.php?/$1 [L]


Original Answer:

RewriteEngine on
RewriteRule ^/iran/iran/(.*)$ /iran/$1 [L]
Josh
If it's in a .htaccess file then replace "^/" with "^"
Greg
A: 

I suppose that you use that rule in the .htaccess file in your document root. If so, try these rules:

RewriteRule ^iran/(iran/.*) /$1 [L,R=301]

RewriteCond %{REQUEST_URI} !^/iran/index\.php
RewriteRule ^iran/(.*) iran/index.php?%{REQUEST_URI} [L]

The first is to redirect /iran/iran/foo externally to /iran/foo. And the second is to pass any request of /iran/foo internally to /iran/index.php?/iran/foo.

Gumbo