Redirect a virtual url

Asked

Viewed 54 times

6

How do I redirect a url from my website to a subfolder.

Example:

Database:

ID | ENDEREÇO | ESCREVER NO INDEX.PHP 1 | example.com/extranet | <span>Sou o extranet</span> 2 | example.com/topico1 | <span>Sou o topico1</span>

In case what I want is for the user to access the URL without having to create several folders on the server with an index in them. thus making navigation simpler.

I thought about an array, but I don’t know how it works much this redirecting.

NOTE: This is a Technica if I’m not mistaken 000webhost.com uses in Zyrowebsitebuilder.

An array for example:

$pages = array(
        '0' => array('id' => '1', 'alias' => 'extranet', 'file' => '1.php'),
        '1' => array('id' => '2', 'alias' => 'topico1', 'file' => '2.php'),
        '2' => array('id' => '3', 'alias' => 'topico2', 'file' => '3.php')
    );

And in the case after that array it executes include('$pages[NUMERO]');

  • It’s confusing to discern what to answer. I’m not sure if you just want to redirect from X to Y or if it’s feasible to explain about MVC or routing. If you could rephrase the question, it might help us understand.

  • edited the answer!

  • Edited the question you meant right?

  • sorry, yeah! : )

  • 6

    Check this question here, it may solve your problem http://answall.com/q/95310/3938

  • yes, in that question this very complex! I want something more summarized.

  • 1

    If I got it right, URL friendly should suit you, no?

  • So put this answer please for me to approve, but there’s a problem, as I define the list "array" url?

  • The first code posted in the answer I gave there is exactly what you want, the only change you might need is to assemble the variable $routes from there with bank information. But think that in any request you make, you will have these searches in the bank

Show 4 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.