18

I'm trying to rewrite

http://www.example.com/directory/folder/*

to

http://www.example.com/directory/*

the htaccess file is in directory

this is my .htaccess file :

RewriteEngine on RewriteBase /directory/ RewriteRule ^(.*)$ folder/$1 [L] 

Any help would be much appreciated.

2 Answers 2

21

This is what I ended up doing :

Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_URI} !(.*)folder RewriteRule ^(.*)$ folder/$1 [L] 
Sign up to request clarification or add additional context in comments.

2 Comments

If you have files in directory folder, How to access it? Please give me solution. I tried above code but it allways redirect to the subfolder's index.php page and I'm using Codeigniter inside of the subfolder
@Sparkup - For core php, it is working absolutely fine for me. Thanks a lot for sharing this solution.
5

What about this?

RewriteEngine on RewriteRule ^folder/(.*) /directory/$1 [L] 

Or you can go without [L] or use [R] instead.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.