Home How can I mod rewrite all traffic to index.php but also to a backend directory?
Reply: 0

How can I mod rewrite all traffic to index.php but also to a backend directory?

user1133
1#
user1133 Published in April 22, 2018, 12:58 am

I have a .htaccess as follows:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{REQUEST_URI} !^public
    RewriteRule ^(.*) index.php [L]
</IfModule>

My directory is set up as follows:

root directory:
  html:
      index.php
      .htaccess
  server (code):
      site:
          index.php
          test.php

Requests go into html/index.php, and then the server gets initiated in the backend. Calling $_SERVER['REQUEST_URI']; yields the following for http://localhost/

Request URL : /index.php

This is correct, because I can then add on site/index.php. However, I want to also do http://localhost/test and have it changed to /site/test.php. The following is what happens when calling $_SERVER['REQUEST_URI']; for http://localhost/test

Request URL : /testindex.php

What should happen is Request URL : /test so then I can add on the site/test.php myself.

Thank you!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.318185 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO