I have the following structure
-www
-subfolder
In www
I have my main site's index.php
.
In subfolder I have a sort of admin UI and in there I'd like to have another index.php
for the admin UI.
Currently my requests from within /subfolder/index.php
get redirected to www/index.php
and basically the pages of my admin UI don't show up.
This is my .htaccess
file:
RewriteEngine On
RewriteRule ^$ index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)$ index.php?lang=$1&page=$2 [L]
Can you help me? I've tried several options in other answers but as I'm no so advanced a web developer, I couldn't get any to work.
@TerryE, Sorry if I have come off as crude.
I am using a local setup for testing.
I have installed Vertrigo server, which gives me Apache server.Running on Windows7 OS. The server is installed in Program filesVertrigoServApache folder.
My public folder is www. In there I have my main site definition. . The site is accessed locally via 127.0.0.1/index.php
or 127.0.0.1/
I have site localization so URLs are constructed as /$lang/$page
e.g. <a href=" / <?php echo $lang; ?> / home "> HOME </a>
In index.php
of main site I have the following:
$page = trim( ( isset( $_GET[ 'page' ] ) ? $_GET[ 'page' ] : 'home' ), '/' );
$lang = trim( ( isset( $_GET[ 'lang' ] ) ? $_GET[ 'lang' ] : 'en' ), '/' );
$langs = array( 'en', 'fr', 'ru' );
And upon this data I get to open the pages this way:
include 'html/'. $lang . '/' . $page . '.php';
All my main site's pages lie in www/html/$lang/
$_SERVER['REQUEST_URI'])
gives /en/home
for page HOME.
127.0.0.1/en/home
WORKS
All navigation works perfectly for the main site.
However I have created an admin UI which lies in folder www/admin - one level below in www.
And in there I don't have any localization. I just have EN as language.
So at the top of the index.php in admin folder I have again
$page = trim( ( isset( $_GET[ 'page' ] ) ? $_GET[ 'page' ] : 'home' ), '/' );
However, here navigation is as follows <a href=/admin/home"> HOME </a>
and upon this I get to construct the pages in the index.php in admin folder as follows:
include 'html/ . $page . '.php';
the pages lie in www/admin/html
This does not work at all. Whenever I press home link in admin UI, I get redirected to my main site (non-existing page). If I add RewriteRule ^subfolder/ - [L]
in .htaccess, I get HTTP 404 NOT Found error
.
127.0.0.1/admin/home
DOES NOT WORK. Neither does any other navigation from within admin. Thank you for your willingness and patience to help me!
See Question&Answers more detail:
os