G
G
gilzomc2015-03-22 16:35:07
PHP
gilzomc, 2015-03-22 16:35:07

How to remove extra directories from url???

Greetings! I need your help.
There is site.ru at the root there is a wer folder, there are several more folders in it, and in these folders in each one index.html file
, you get the following address site.ru/wer/fer/index.html
site.ru/wer/fer3/ index.html
site.ru/wer/fer2/index.html
how to make it open at this address site.ru/fer/

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Z
zdiii, 2015-03-22
@zdiii

warrex.net/scripts/article/4493-kak-sdelat-chpu-s-...

G
gilzomc, 2015-03-22
@gilzomc

I would like a good example? on my example that I described! if possible, I try it myself, nothing comes out

6
65536, 2015-03-22
@65536

.htaccess

RewriteEngine on
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?uri=$1 [L]

index.php
<?php

...

$uri = explode('/', $_REQUEST['uri']);

if ( $uri[0] == 'fer' )
{
    print file_get_contents('wer/fer/index.html');
}

...

N
Nikita Ignatenkov, 2015-03-23
@kiting

This is how it should help.

RewriteEngine On
RewriteRule ^wer/(.*)$ /$1 [QSA, L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question