[Vuejs]-How to get the php address bar, if I use Vue?

0👍

echo $_SERVER ['REQUEST_UR'];

‘REQUEST_URI’
The URI which was given in order to access this page; for instance, '/index.html'.

This is what you are looking for path_info

$_SERVER['PATH_INFO'];

‘PATH_INFO’
Contains any client-provided pathname information trailing the actual script filename but preceding the query string, if available. For instance, if the current script was accessed via the URL http://www.example.com/php/path_info.php/some/stuff?foo=bar, then $_SERVER['PATH_INFO'] would contain /some/stuff.

More examples : https://www.php.net/manual/en/reserved.variables.server.php

Or you can use .htaccess 301 redirect all.

Htaccess solution :

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain-name.com$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain-name.com$
RewriteCond %{REQUEST_URI} !Nature-Wallpaper/
RewriteRule (.*) /Nature-Wallpaper/$1 [L]

Now your site root will be changed to Nature-Wallpaper

See more explanition on htaccess here : https://www.siteground.com/kb/how_to_change_my_document_root_folder_using_an_htaccess_file/

Leave a comment