Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL Rewriting and Final Website #17

Open
ghost opened this issue Oct 30, 2018 · 2 comments
Open

URL Rewriting and Final Website #17

ghost opened this issue Oct 30, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Oct 30, 2018

image

hi Tom, thank you. i made it using xampp with directory structure C:\xampp\htdocs\ijdb6\Project\public

if anyone wants to try using xampp, here's how:

  1. first and foremost you need to change your Apache server root folder from default one at htdocs (c:\xampp\htdocs) to public (c:\xampp\htdocs\ijdb6\Project\public). i use this directory structure but should also work for any directory structure you choose

change file httpd.conf like this:
image
you can search the file in c:\xampp\apache or you can hit Config button in Xampp control panel and choose httpd.conf file

dont forget to stop and restart your apache server so the change will take effect. just hit stop and start button in Xampp control panel

  1. create .htaccess file and place it in root folder. our new root folder now is 'public'. the content like this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /index.php [NC,L,QSA]

you can create this file using IDE or using notepad. with notepad choose to 'save as' and 'save as type' All Files

  1. type localhost in your browser address bar, and, voilaa..
    if you like to have a feeling like you are accessing a real server, you can change localhost to mydevserver.com or any whimsical name you can come up to by edit file hosts located in C:\Windows\system32\drivers\etc

image

you need windows special permission to make the edit. try make the edit using windows provided account named administrator

thats all.

Tom has introduced very good technique that we should put our front controller (index.php) and other necessary files in root folder but put those important files outside of this folder. by making these changes we can make our root folder 'public' to serve the internet while we put the important files out from this folder. it greatly improve security

the provided .htaccess file make sure that for every non-existent folder/path or file we query in browser's address bar will go to index.php. the next thing is obvious, we make the index.php to response to specific URI. in other words, any URI is acceptable to the controller as long as we provide their corresponding response

@bobate
Copy link

bobate commented Nov 12, 2019

Are you still working on this website framework? I'm more than a year behind you and having mixed results, looking for some guidance from someone who may have figured it all out, or can plod along with me. I've been working on it about two months at this point.
I keep running into walls, taking a day to a week to resolve the problems. I had it more or less on track up thru categories, but now in Permissions I'm at a wall again.
Would you have time and patience to respond to problems I would send you?
Thanks
Nate

@ghost
Copy link
Author

ghost commented Nov 19, 2019

hi Nate, sure.
Tom wrote a very good book but sure the reader still need enough background to make their life easier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant