3

I want to redirect to the url localhost/anno to localhost/tut/anno

I referred this question

and wrote this .htaccess rule

RewriteCond %{HTTP_HOST} ^(www\.)?localhost\anno$ [NC]
RewriteRule !^localhost/ /tut/anno%{REQUEST_URI} [L,NC]

But still i am getting 404 error.

What is the wrong i my rule ?

Community
  • 1
  • 1
SA__
  • 1,782
  • 3
  • 20
  • 41

1 Answers1

2

You can use :

RewriteEngine on
RewriteRule ^anno/(.*)$ /tut/anno/$1 [NC,L]

This internally redirects "/anno/foo" to "/tut/anno/foo"

EDIT

you need to Reorder your rules like this :

RewriteEngine On

RewriteRule ^anno/(.*)$ /tut/annotorious/$1 [NC,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Amit Verma
  • 40,709
  • 21
  • 93
  • 115
  • Hey, thanks, it works when i have like [yours](https://eval.in/428634) but does not works, if i have like [this](https://eval.in/428635) .... – SA__ Sep 06 '15 at 04:33