0

I am trying to configure my index.php from the document root to open the other files. I don't need to do that on the .htaccess My file structure is the following:

/application
    /database
       /dbmanager.php
    /php
       index.php
       login.php
/models
/resources
    /css
       /master.css
    /js
       /general.js
    /img
       /logo.png
index.php

What I want is to configure so I can pick the files request from the index.php root to the application/php/ folders. In my index.php from the document root I have this:

<?php


if (($_SERVER['REQUEST_URI']) == '/login') {
    require('application/php/login.php');
    exit();
} else {
    require('application/php/index.php');
    exit();
}

?>

Also, I don't want to appear the application/php/login.php on the link but only /login My HTML link is :

<a href="<?php echo $domain; ?>login" >Login</a>

$domain is the full path domain of my localhost so I don't always write everything. In this case is: "http://localhost:81/{project_name}" and the /login will pick up the file on the folders.

UPDATE:

RewriteBase /application/php/

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f


RewriteRule ^([a-zA-Z0-9_-]+)$ ./application/php/index.php

RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ ./application/php/index.php

RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ ./application/php/index.php
  • that's what you need .htaccess for! I doubt that's possible without – Jeff Mar 30 '17 at 18:08
  • @Jeff Can you help me with the .htaccess? How to do that so I can call it well? I edited my question with the htaccess code – Nunix Monteiro Mar 30 '17 at 18:09
  • this will help: http://stackoverflow.com/questions/30709741/rewrite-url-from-index-phppage-about-to-page?rq=1 – Jeff Mar 30 '17 at 18:19

0 Answers0