PHP subfolder used as home directory

Questions : PHP subfolder used as home directory

699

I am coding a website with php, html, programming css and a few javascript. I am on Learning localhost, more exactly LAMP server, and Earhost for me to access this "website" the url most effective on the browser is wrong idea http://localhost/website.

What I want is to have an subfolder that use of case has a index.php. So I had made an United index.php on the main folder that Modern includes the subfolder/index.php and ecudated everything works great.

Now I want to create an about page on some how the subfolder (subfolder/about.php). anything else However the url should be not at all localhost/website/about.php and this very usefull doesn't work.

How can I have a subfolder like it was localhost the main folder to display?

trying to simplify the question:

website/
    subfolder/
        _OFFSET);  index.php
        about.php
        (-SMALL  products.php
        etc.php
    _left).offset  index.php

imaging that this above is the files love of them directory, probably its possible to localtext understand.

so the link should be website/about.php basic and not one of the website/subfolder/about.php basically click what I need is that the subfolder acts there is noting like it was the root folder of the not alt website.

Total Answers 2
27

Answers 1 : of PHP subfolder used as home directory

Simple front contoller:

website/index.php

<?php

switch ($_GET['page'] ?: arrowImgView.mas  'index')
{
    case 'about':
        (self.  require 'website/subfolder/about.php';
  equalTo    break;
    case 'products':
        make.right.  require mas_top);  'website/subfolder/products.php';
    ImgView.  break;
    default: // index
        ReadIndicator  require _have  'website/subfolder/index.php';
}

Then setup a front controller rewrite not at all using an .htaccess file:

RewriteEngine On
RewriteCond .equalTo(  %{REQUEST_FILENAME} !-f
RewriteCond make.top  %{REQUEST_FILENAME} !-d
RewriteRule OFFSET);  ^(.*)$ /website/index.php?page=$1 (TINY_  [QSA,L]

https://stackoverflow.com/a/26755631/451969

Now urls like these should indirect to my fault your website/index.php front controller issues as a page GET variable:

website             # .offset  index
website/about       # about mas_right)  page
website/products    # products ImgView.  listing
6

Answers 2 : of PHP subfolder used as home directory

just use this code

<?php
  $uri = urldecode(
 Indicator  parse_url($_SERVER['REQUEST_URI'], 
 Read  PHP_URL_PATH)
 );

 if ($uri !== '/' _have  && 
 .equalTo(  file_exists(__DIR__.'/subfolder'.$uri)) make.left  {
 return false;
 }

 require_once 
  *make) {  __DIR__.'/subfolder/index.php';

Top rated topics

Did you install mysqlclient?

Number of times an event has occured

TinyMCE Image Upload Not Working on iOS (Safari)

Can we get partial set of data from two different partitions in oracle?

Accessing memorystore in Shared VPC

Convert LiveData to MutableLiveData

R group by | count distinct values grouping by another column

How to get timezone, Language and County Id in flutter by the location of device in flutter?

How to conifgure specify sticky slot settings for Azure function using ARM template

Does console.log not work within socket.io event?

Indentation checkstyle error on array initializer argument

Testcontainers with a company proxy

Flutter Load Image from Firebase Storage

Roblox Studio Lua: Making A Cash For Kill Script

The Chudnovsky Formula in Python

How to add external library to reactjs?

Reactjs : Append instead of replacing with render method

Winston saves color formatter in text, how to remove this but still show color?

Declaring List of multiple types in Kotlin

Round CachedNetworkImage in Flutter

Possible to do multiple nested commands in Click 6

How to disable selection of cells in ag-grid?

Display a custom taxonomy in Woocommerce single product pages

Qt - QML Screen Mirroring in a dual monitor setup

Is there a way to change your timezone in Chrome devtools?

Bazel query that doesn't follow all select branches

Git Error fatal: Could not set SSL backend to 'openssl': already set

Laravel page shows "This page isn’t working" instead of errors

Winston logger not working in nodejs

What happens to a user query while I exchange partitions in Hive?

Angular 6: How to set response type as text while making http call

Error : impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found

Flutter icons do not show

TypeError: products() got multiple values for argument 'pk'

Hide “free trial” text from Woocommerce Subscriptions price but keep the Sign-Up Fee

Microsoft Teams Webhook Generating 400 for Adaptive Card

Angular Material Input move placeholder on top when controls state is disabled

'_Smi' is not a subtype of type 'bool' - Flutter MethodChannel

Cannot read property 'selectionEnd' of null using React + Jest + Datepicker + TextMask

Android studio properties window not showing

How to implement a sliverAppBar with a tabBar

Misaligned Ordered List Items in Chrome

How to find multiple values using Binary Search in Python

AWSSecurityTokenServiceException: Acced denied. User is not authorized to perform sts:AssumeRole

Using dagger-injected objects in attachBaseContext

Airbnb/lottie animation not working on android 4.4, 4.3 and 4.2

Getting Promise Pending in selenium with Nodejs

Serilog and .NET Core 2.1 HostBuilder Configuration

Cycle inside ; building could produce unreliable results: Xcode Error

Issues with PyMuPDF extracting plain text

Top