I want to run the hello.php
from input/index.php
to input/output/hello.php
when the link on index.php
was clicked. I have googled it but cannot find the solution? Any solution for this?
Just put a /
in the URL.
<a href="output/hello.php">
Sometimes, i have a problem when just using (with your example) "output/hello.php" so i use "./output/hello.php", maybe it could work for you.
What you are asking I think is more about URLs, you have to create a file called:
.htaccess
Just like that, with the dot at the beginning. You can use this code inside of it:
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^.*$ ./index.php?u=$1
Now, all the requests are going to go to the index.php file, ALL!! no matter if you write /lalala, is still going to go to index.php, so you have to parse the URL, that way, you can know what are you receiving and be able to execute any method that you want. Example:
$url = 'http://' . $_SERVER[HTTP_HOST] . $_SERVER[REQUEST_URI];
$parsedUrl = parse_url($url);
$parsedUrl['path'] // Is the var that has the info after yourdomain.com/
Once you have that, you can separate that with explode('/', $parsedUrl['path'])
and analize the data. So you can write /input/output/hello.php and you can receive the data in index.php