mrnikper Posted March 1, 2023 Share Posted March 1, 2023 (edited) Hey! I have a question please. First of all let me explain, My server dosn't accept .htaccess, they using nginx, and I don't have access to nginx files too. Now, I want to make custom urls for my custom website, but there is a problem, I don't want everything to be to the main root (www). I want to put the files inside the folders, but still I want the urls to be diffrent. I want the login page to be in specific folder with the name access, but I want the visitor to see it like: .com/login and no .com/access/login. I found a solution to change the 404.php see bellow to understand: <?php require_once 'inc/routes.php'; $request_uri = $_SERVER['REQUEST_URI']; if ($request_uri == '/') { // Show the homepage include('index.php'); } elseif ($request_uri == '/login') { // Show the about page include('access/login.php'); } else { // Show a 404 error http_response_code(404); include('error.php'); } ?> That supose to do what I have in my mind, and works I see the page, but the problem is the buttons stop working. The user see /login on the search bar, but the real name of the page is 404.php and the login.php file cannot submit any request because actually the login change to 404. So the buttons dosn't work. There is any other way to make custom links, to put every php file in specific folder, but still use custom url to navigate the users there? Or to do something in action of submit, to forward the proccess, to complete the proccess, but the user not see any diffrence to the url? Edited March 1, 2023 by mrnikper Quote Link to comment https://forums.phpfreaks.com/topic/315966-custom-links/ Share on other sites More sharing options...
requinix Posted March 1, 2023 Share Posted March 1, 2023 The correct solution is to use something set up in the server configuration to let you do URL rewriting - without having to resort to anything to do with 404 pages. Have you tried asking the people who run the server what they can offer you in the form of URL rewriting? It's an extremely common behavior for websites so it's hard to believe they aren't providing you a way to do it. Quote Link to comment https://forums.phpfreaks.com/topic/315966-custom-links/#findComment-1606125 Share on other sites More sharing options...
mrnikper Posted March 2, 2023 Author Share Posted March 2, 2023 Ask for help to them, and the say to send the links to do it, but I can't send message every time and w8 them to complete the proccess. At the end, how worpress, joomla and other platforms do it without problem? I see wordpress have .htaccess but my hosting dosn't read it, but the links are custom without problem, without need to setup anything on the server. Must be something 😕 Quote Link to comment https://forums.phpfreaks.com/topic/315966-custom-links/#findComment-1606126 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.