I may sound dumb but how to setup routes eg. /login /signup /homr

Website URL

dznv.online

Error Message

none

Other Information

just wanna know

Would you be comfortable using certain frameworks which have routing system built in? Laravel is good one.

5 Likes

There are roughly two ways to do it:

  • Create folders with the names login, signup, home, etc. and put an index.php or index.html file in it.
  • Use .htaccess rules to redirect any URL that doesn’t match an existing file or directory to a central index.php file, and have some logic in there to determine which page should be shown depending on the request URL.

That last option is what most CMS and virtually all frameworks do.

5 Likes

so htaccess is main one and any other folders is routes?? bro thank you

@Admin i might be a little silly but
https://alfie.dznv.online/emails this doesnt work

i added extra information in the photo bc idk

All files and folders must be inside the htdocs folder to be accessible.

htdocs folder is website root

8 Likes

i found that out but its only /index.html and the css isnt really applying for some reason

ok i got css working but not like the custom named routes instead of index.html

guys it randomly just worked i guess servers are slow right now and took long to publish

i edited the topic if anyone wanna answer

I reverted your post to the first edit of it. Please create a new topic for a new question to prevent confusion.

Thanks

4 Likes

the “emails” folder redirects to home
but then your index.php has a redirection loop and leads to itself

5 Likes

its like that because im tryna do the domain linking from cloudflare (i think u said how to) but its just not working fr

The DNS in CloudFlare is not the cause of the endless redirect. Or maybe that * entry you have is. Try removing that - it’s not going to work they way you want it to anyways.

3 Likes

just like this yeah?

Should be alright.

2 Likes

could u help fix redirects? i dont know why it says like 20 redirects when nothing should be redirecting if you have discord add @dznv i think itll be easier

I see 403 error which indicates that the index.php file is missing.

2 Likes

i used sitepro for it heres a screenshot
This is for the main file in the image :-1:
index.php (116 Bytes)

this is for the file in the site pro folder
index 2.php (42.5 KB)

My bad, I was looking into the wrong url.
Can you paste the content of htaccess file here? Please format it like this:
```
Test
```

1 Like

is doesnt let u select all to copy

Screenshot can help then.

1 Like
RewriteEngine On
RewriteBase /

#### PERSISTENT CONTENT ####
RewriteCond %{REQUEST_URI} \/(?:store\.log|store\.dat|store\.json|store_orders\.log|invoice-series\.json|ga_code|data\.json|project\.db|[^\.]+\.dat)$ [OR]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ index.php [L,QSA]
``` this is for in the sitepro folder do you want the normal / ?