PHP Virtual Pages

Berk

berkibap#4233
Developer
Oct 17, 2015
863
190
Hello everyone
I want to know, if creating virtual pages are possible with php?
The logic on my mind is:
I add a value to database ('url link aka to include file contents ','user groups that allowed')
I create a file under for example resources/pages/admin/edit.php
When I go to domain.com/adminEdit it should include resources/pages/admin/edit.php
Sorry for shitty formatting and language, i suck at english (still)
 

Jeffrey

Devbest Indian Tech Support
FindRetros Moderator
Feb 5, 2013
1,180
412
Basically just create a web.config file in the root directory of your application.
Then just research how URL rewriting works for IIS.
Tbh would recommend you to switch to Apache.
I would also suggest switching to Apache, it's much easier & faster to install Apache + PHP + MySQL and you don't have to convert from .htaccess -> web.config all the time.
 

TesoMayn

Boredom, it vexes me.
Oct 30, 2011
1,482
1,482
This is untested, and I haven't used IIS in years but try this
Code:
<rewrite>
  <rules>
    <rule name="Rewrite Mapping" stopProcessing="true">
      <match url=".*" />
      <conditions>
        <add input="{StaticRedirects:{PATH_INFO}}" pattern="(.+)" />
      </conditions>
      <action type="Redirect" url="{C:1}" appendQueryString="True" redirectType="Permanent" />
    </rule>
  </rules>
  <rewriteMaps>
    <rewriteMap name="StaticRedirects">
      <add key="resources/pages/admin/edit.php" value="adminEdit" />
      <!-- MORE KEYS FOR MORE REWRITES
      <add key="ORIGINAL" value="REWRITE" />
      -->
    </rewriteMap>
  </rewriteMaps>
</rewrite>
 

Berk

berkibap#4233
Developer
Oct 17, 2015
863
190
Thanks!
 
I would also suggest switching to Apache, it's much easier & faster to install Apache + PHP + MySQL and you don't have to convert from .htaccess -> web.config all the time.
I'd love to but I don't know how to install apache seperated from xampp. That's why I am using IIS.
 

Berk

berkibap#4233
Developer
Oct 17, 2015
863
190
Need this for .htaccess, I need to get all pages from database
Database structure:
-Link to be shown on url bar
-Page to get file from (res/admin/editstaff.php)
As I know I can't use PHP in .htaccess files so... I need help with this.
 

MayoMayn

BestDev
Oct 18, 2016
1,423
683
Need this for .htaccess, I need to get all pages from database
Database structure:
-Link to be shown on url bar
-Page to get file from (res/admin/editstaff.php)
As I know I can't use PHP in .htaccess files so... I need help with this.
Sorry, but I don't understand shit about what you need help with.
 
Last edited by a moderator:

Users who are viewing this thread

Top