remove subdir from url

#1
[eluser]jparent[/eluser]
Hi I have my site, for example: "www.mydomain.com/ci_subdir" I removed the "index.php" from de url and now I move through the page like:

"www.mydomain.com/ci_subdir/controller"

That I want is to know what is the rewrite rule to make:

"www.mydomain.com/controller/"

Thanks!

#2
[eluser]rogierb[/eluser]
I guess something like

Code:
RewriteBase /
RewriteRule ^(.*)$ /ci_subdir/index.php/$1 [L]

#3
[eluser]jparent[/eluser]
I try to explain better:

that's my tree of directories

htdocs/
|- myapp
|-system
|- ... //other folders from codeigniter
|- .htaccess
|- index.php

The content of my .htaccess is that:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|img|img_public|css|js|\.txt|fckeditor|docs)
RewriteBase /
RewriteRule ^(.*)$ /myapp/index.php/$1 [L]

but this code don't remove myapp from the url. It means that I write www.mydomain.com and it doesn't work. I need to type www.mydomain.com/myapp, and then it works. And that I want is to keep this folder structure and when I write www.mydomain.com it moves me to www.mydomain.com/myapp/ without change the url.

And if I type www.mydomain.com/class/method moves me to wwww.mydomain.com/myapp/class/method

Could any body tell me how I shoud do that? Thanks! Smile

#4
[eluser]rogierb[/eluser]
The .htaccess should be in htdocs.

#5
[eluser]jparent[/eluser]
I'll try it and it doesn't work.

#6
[eluser]rogierb[/eluser]
A bit more information might be usefull. "it doesn't work" is kinda demoting.

ok, there should be 2 .htaccess files, one in you root, the other one in your system folder

The one in your root should have something like
Code:
RewriteBase /
RewriteRule ^(.*)$ /my_application_folder/index.php/$1 [L]

The one in your application folder something like
Code:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

#7
[eluser]jparent[/eluser]
Thank's it runs very good! Thank you very much for your detailed explanation!


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.