Sorry for noob question, can't understand from what I should search.
I'm making a site with that page product.php?id=777
I'd like it to be product/777
Thank you!
php” file is placed inside the “htdocs” folder. If you want to run it, open any web browser and enter “localhost/demo. php” and press enter. Your program will run.
You can make a PHP script to run it without any server or browser. You only need the PHP parser to use it this way. This type of usage is ideal for scripts regularly executed using cron (on *nix or Linux) or Task Scheduler (on Windows). These scripts can also be used for simple text processing tasks.
Create .htaccess file in your web root and enter following there:
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^product/([0-9]+)$ product.php?id=$1
Instead of using mod_rewrite you can also use following in your .htaccess:
DefaultType application/x-httpd-php
And just name your script product
on the server (without .php file extension).
So you can invoke it directly and would receive any appended string as $_SERVER["PATH_INFO"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With