Actually this is the best video I have ever watched. I was just laughing at myself when I was watching this. Soooooo sweet, simple, on to the point.....It's every thing I have been looking for. Thanks MAN. I would request you to make a video on more about making HTACCESS .
i understand you man, this happens to me way often. You're looking for a solution for hours and hours and when you finally find it, the smile of joy comes out and you don't even notice it :D
This is probably the simplest and most practical version I seen on this subject. You are simple awesome my man!! I do have one questions though.. in HTACCESS how do I go about if I have admin page so I want link to go through admin and then public pages that go through index... how do I tell server there is two channels? should I just make new lines and add admin.php?$2
Thank you very much for this video. I am getting stuck on my screen show the word Profile, appearing on screen what ever I write! Please help! Do you have an idea why this is happening? I am also getting : [REQUEST_METHOD] => GET [QUERY_STRING] => but QUERY_STRING IS NOT SHOWING, GETTING REQUEST_URI instead. thank you very much in advance
You are wonderful bro, I cherish your way of teaching, please I want to ask, how can we use this for a website that has user profile whereby user login and register?
I have several videos here on signup and login but I don't think any of them use this system. You've just given me an idea for my next video. I'll make one in a the next 2 days
This is good but it defies the purpose of htaccess and you should not user $_SERVER value directly. You are hacking it. The point of htaccess is to filter out these parameter before any files are parsed even. However the problem with htaccess is when it finds a match it leaves your url unchanged but returns the right url. So this is good method to clean the url in the index file you can check for all the files you have and what parameters they require and return only those and remove the junk usually the users do not temper with urls and the href within your code will always return correct format, so this is to make it super clean and fool proof
true, its a hack. two things i like about this method are 1. since all urls are redirected to the index file, you dont need to write so many rewrite conditions in the htaccess file, which can get pretty confusing especially for beginners. 2. since all urls are redirected to the index file, if you want to shut down the website for maintenance, you only need to shut down the index file and the whole website goes offline. this prevents alot of headaches from my own real world experience, thats why i prefer this hack over the norms
Where you used RewriteRule ^(.*)$ index.php can't we just do RewriteRule ^(.*)$ index.php?url=$1 and then use $_GET to retrieve the URL instead of the server global. Or would server global still be the better option?
@@behzadkhokher7998 sure you can use that alternative. both _server and _get are globals so you can use what you're comfortable with. i only use _server because even if the query string is missing, as it would when someone is on the home page, server['query_string'] still exists, whereas _get will be empty. but that can be solved by checking whether it exists or not. its all about preference
@@QuickProgramming I'd love to hear about what the norm is and how that works. I've seen versions where you write your links with the filepath syntax instead of query strings and then that's parsed in to the querystrings behind the scenes - and then that's masked but it was super confusing!
I tried this with xampp and it works but when I try this on a live server it doesnt work, why? Im able to do this configurations on my server 500 internal server error
It means you have an error in your htaccess file. Check the text in there letter by letter and make sure it matches the one in the video. If you fail to find the problem, send me a screen shot of the htaccess file on Facebook here facebook.com/quickcode
Just like in the tutorial, you can load each page into the index page as if they are separate pages. The index page acts as a routing system and not a real page. Also with part 2 of this tutorial
Great video ! Thank you a lot But I have a question, with this method, can we still register a new member on our website by redirecting on an other page, register.php for example.. ?
yes you can. what you do is put all your register code inside the register.php file as you would normally. then redirect your user to e.g www.yourwebsite.com/register .everything will still go through the index file, but it will require the register.php file along the way and all the POST variables will also be available as they normally are. thats how i build all my sites so i know it works from experience. you can ask further questions if you find any problems using this method.
Good, however I do not recommend making this structure. This structure is kind of barbaric. It's too simple. Later it will create problems. I do recommend having a central point, a controller, just like in the video. An url handler is good too. But rather invite code, than have subpages.
thanks. this is just to show whats possible. i left it open for the programmer to do what they want with it. you can create a URL handler etc to handle things better as you code. i use this in my own projects and it hasn't created any problems so far. i use a very simple URL handler, which puts all variables in an array called $URL. so depending on which location the variable is, it determines what type it is, e.g [0] = page_name, [1] = controller, [2] = product, [3] = page_number etc. it also accounts for situations where other variables dont exist. i simply copy this handler from project to project and have never gone back to edit the code. but if theres a problem you're thinking of that i havent considered, i'll be happy to hear it so i can make a followup video to address that for the sake of others who dont know
i think its because you're using relative paths to define your css file, js and images. e.g instead of you have to write like this in short, you have to ggive absolute paths. i explain this and how to do it dynamically in the second part of the video here-> ruclips.net/video/39ax8OgOGiw/видео.html
Hi how are you ? i have url index.php?page=login and login redirect to customer.php?page=dashboard in this page have order this customer.php?page=dashboard&orderby=asc how rewrite friendly this url
am fine thanks. my method will only work if you use one php page for the whole website, which is index.php, and then include the right pages depending on the url. this way you only need a few lines of code in the HTACCESS files, which is less confusing. so for your situation, after a user visits index.php?page=login,(www.yoursite.com/login) redirect them to index.php?page=customer&activity=dashboard&orderby=asc, which you can rewrite as www.yoursite.com/customer/dashboard/asc. this way no matter the url, all requests go through the index page and then the first parameter in the url determines what file will be included and displayed. the rest of the parameters(/dashboard/asc) are for the content
Do more videos and project. You aren't just a great teacher but also a good presenter: so clear and consistent
Thanks, will do! i appreciate your encouragement :)
Actually this is the best video I have ever watched. I was just laughing at myself when I was watching this. Soooooo sweet, simple, on to the point.....It's every thing I have been looking for. Thanks MAN. I would request you to make a video on more about making HTACCESS .
thanks and am glad it helped you out. i'll try and do more videos on htaccess
i understand you man, this happens to me way often. You're looking for a solution for hours and hours and when you finally find it, the smile of joy comes out and you don't even notice it :D
Great tutorial, QP! You explained it very clearly and I have finally managed to give my websites clean URLs. Thank you! :)
Glad to hear it and you're most welcome. just make sure to see part 2 also on how to make sure images and css are visible when the url is longer
iam happy with this tutorial and all tutorials you post your channel are very important. thank you very much.
Omfg it finally worked. I searched for almost an hour.
Nice! Am happy it worked out😊
This is probably the simplest and most practical version I seen on this subject. You are simple awesome my man!!
I do have one questions though.. in HTACCESS how do I go about if I have admin page so I want link to go through admin and then public pages that go through index... how do I tell server there is two channels? should I just make new lines and add admin.php?$2
Great !! Have been wondering where i was missing my css files!!! Helped a lot! Thanks...
you are most welcome, thanks alot for the comment
when i typed it, I cant access my website file in htdocs
Amazing tutorial! This helped me alot!
Glad to hear it! thanks
I saw some other videos but this video really helped me, thanks !
You're most welcome :)
second comment with my second channel, thank you man again
you're most welcome
Thank you very much for this video. I am getting stuck on my screen show the word Profile, appearing on screen what ever I write! Please help! Do you have an idea why this is happening? I am also getting : [REQUEST_METHOD] => GET
[QUERY_STRING] => but QUERY_STRING IS NOT SHOWING, GETTING REQUEST_URI instead. thank you very much in advance
You are wonderful bro, I cherish your way of teaching, please I want to ask, how can we use this for a website that has user profile whereby user login and register?
I have several videos here on signup and login but I don't think any of them use this system. You've just given me an idea for my next video. I'll make one in a the next 2 days
This is good but it defies the purpose of htaccess and you should not user $_SERVER value directly. You are hacking it. The point of htaccess is to filter out these parameter before any files are parsed even.
However the problem with htaccess is when it finds a match it leaves your url unchanged but returns the right url. So this is good method to clean the url
in the index file you can check for all the files you have and what parameters they require and return only those and remove the junk
usually the users do not temper with urls and the href within your code will always return correct format, so this is to make it super clean and fool proof
true, its a hack. two things i like about this method are 1. since all urls are redirected to the index file, you dont need to write so many rewrite conditions in the htaccess file, which can get pretty confusing especially for beginners. 2. since all urls are redirected to the index file, if you want to shut down the website for maintenance, you only need to shut down the index file and the whole website goes offline. this prevents alot of headaches from my own real world experience, thats why i prefer this hack over the norms
Where you used RewriteRule ^(.*)$ index.php can't we just do RewriteRule ^(.*)$ index.php?url=$1 and then use $_GET to retrieve the URL instead of the server global. Or would server global still be the better option?
@@behzadkhokher7998 sure you can use that alternative. both _server and _get are globals so you can use what you're comfortable with. i only use _server because even if the query string is missing, as it would when someone is on the home page, server['query_string'] still exists, whereas _get will be empty. but that can be solved by checking whether it exists or not. its all about preference
@@QuickProgramming I'd love to hear about what the norm is and how that works. I've seen versions where you write your links with the filepath syntax instead of query strings and then that's parsed in to the querystrings behind the scenes - and then that's masked but it was super confusing!
I tried this with xampp and it works but when I try this on a live server it doesnt work, why? Im able to do this configurations on my server 500 internal server error
It means you have an error in your htaccess file. Check the text in there letter by letter and make sure it matches the one in the video. If you fail to find the problem, send me a screen shot of the htaccess file on Facebook here facebook.com/quickcode
Hii sir i am having Nginx Engine for that what should i do , it's Urgent reply plz
thats usually an online server error. does it still happen when you remove the HTACCESS file?
If having more than one php file.. how do I make clean url for as per my requirement...?
Just like in the tutorial, you can load each page into the index page as if they are separate pages. The index page acts as a routing system and not a real page. Also with part 2 of this tutorial
Great video ! Thank you a lot
But I have a question, with this method, can we still register a new member on our website by redirecting on an other page, register.php for example.. ?
yes you can. what you do is put all your register code inside the register.php file as you would normally. then redirect your user to e.g www.yourwebsite.com/register .everything will still go through the index file, but it will require the register.php file along the way and all the POST variables will also be available as they normally are. thats how i build all my sites so i know it works from experience. you can ask further questions if you find any problems using this method.
Not working for, please me. Please help.
Syed, what part exactly is not working?
Cdc
Vvvďvxd 😬😠😯😯😯😉😇😕😕😕😠😠😆 🔰💄⌚⌚⌚👓👠👙👙👙💲♐♐ 🔙🔙♉♉♏♐♈
Good, however I do not recommend making this structure. This structure is kind of barbaric. It's too simple. Later it will create problems. I do recommend having a central point, a controller, just like in the video. An url handler is good too. But rather invite code, than have subpages.
thanks. this is just to show whats possible. i left it open for the programmer to do what they want with it. you can create a URL handler etc to handle things better as you code. i use this in my own projects and it hasn't created any problems so far. i use a very simple URL handler, which puts all variables in an array called $URL. so depending on which location the variable is, it determines what type it is, e.g [0] = page_name, [1] = controller, [2] = product, [3] = page_number etc. it also accounts for situations where other variables dont exist.
i simply copy this handler from project to project and have never gone back to edit the code. but if theres a problem you're thinking of that i havent considered, i'll be happy to hear it so i can make a followup video to address that for the sake of others who dont know
thank you man
You're welcome!
Wow 5yrs ago
Is the HTACESS work on wampserver?
yes it works
it works for me . but as soon as my page is loaded it looks like a simple html page it removes css, js and images? how this problem can be solve???
i think its because you're using relative paths to define your css file, js and images. e.g instead of you have to write like this in short, you have to ggive absolute paths. i explain this and how to do it dynamically in the second part of the video here-> ruclips.net/video/39ax8OgOGiw/видео.html
i am doing this in locally and i have tried localhost......... but it does not work
thanks now it works
awesome, am happy to hear that :)
i need ur help once more..... Please tell me how to remove %20 from url i mean currently my url is uppsc%20result and i want like this uppsc-result
Hi how are you ? i have url index.php?page=login and login redirect to customer.php?page=dashboard in this page have order this customer.php?page=dashboard&orderby=asc how rewrite friendly this url
am fine thanks. my method will only work if you use one php page for the whole website, which is index.php, and then include the right pages depending on the url. this way you only need a few lines of code in the HTACCESS files, which is less confusing.
so for your situation, after a user visits index.php?page=login,(www.yoursite.com/login) redirect them to index.php?page=customer&activity=dashboard&orderby=asc, which you can rewrite as www.yoursite.com/customer/dashboard/asc.
this way no matter the url, all requests go through the index page and then the first parameter in the url determines what file will be included and displayed. the rest of the parameters(/dashboard/asc) are for the content
I tried hard but still not getting the result please help me
what error are you getting?
@@QuickProgramming server error
Not working for, please help me in codes.
am happy you finally got it working :)
Good job bro, JESUS IS COMING BACK VERY SOON;WATCH AND PREPARE
how to make localhost/spy%20bloger%20old/products.php?pid=Wireless%20Camera like localhost/spy%20bloger%20old/Wireless%20Camera