'Why url is not displayed on the website how can i solve this issue is it because am using ip address instead of url example like "myipaddress"/mvc ??
In php
<?
print_r($_GET['url']);
?>
in .htaccess
php_value error_reporting -1
php_flag display_errors on
php_flag display_startup_errors on
php_flag ignore_repeated_source off
php_flag ignore_repeated_errors off
php_flag track_errors on
php_flag log_errors on
php_flag mysql.trace_mode on
RewriteEngine On
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
the output i should get in the webiste is : index.php
Solution 1:[1]
Because $_GET global array gets only when you have GET request with key url.
If you want to get current url, you can use $_SERVER global array instead.
$current_url = sprintf(
'%s://%s/%s',
isset($_SERVER['HTTPS']) ? 'https' : 'http',
$_SERVER['HTTP_HOST'],
$_SERVER['REQUEST_URI']
);
echo $current_url;
With this you can get current URL
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Farhod Nematov |
