开发者

.htaccess in subdirectory

I've been searching the whole evening for a solution/approach for my problem with my .htaccess file.

Basically I have www.site.com with a .htaccess in the www directory with the following content:

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !^(/admin)
RewriteRule ^[^_+/]. index.php

It works just fine and allows www.site.com/en/articles/Interesting_title/3 to be parsed by index.php which reads which controller, language and what article to display.

However I'd like for the admin system to work the same way. www.site.com/admin should have an .htaccess files that allow me to write URL's this way.

www.site.com/admin/en/articles/article_title/3 should allow me to edit article number 3 using en english UI.

Dumping $_SERVER['REQUEST_URI'] in the first case gives "en/articles/Interesting_title/3"

Dumping $_SERVER['REQUEST_URI'] in the second case gives "admin/en/articles/article_title/3"

If I at a later point choose to move administration to www.site.com/shasso开发者_如何转开发oo I would like to avoid changing any code other then the .htaccess files.

Cheers


Append this line in the same .htaccess file you have, not under admin sub directory:

RewriteCond %{REQUEST_URI} !^/admin/index.php$ [NC]
RewriteRule ^admin/[^_+/]. /admin/index.php [L,NC]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜