Search-Engine Friendly URLs

丶灬走出姿态 提交于 2019-11-29 11:31:00

You can use .htaccess for apache, create file in your root folder of web mainly "htdocs" name it ".htaccess" add next content to it

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
    Options -Indexes
</IfModule>

in your php file you can access data from $_GET

$_GET['url'];

Then you can use data to parse what you need.

Nick ODell

Yes, the first option would be pretty hard to maintain. If you want to change the header of the pages, you'd need to recalculate all of the pages.

The simplest way to do that would be to have a PHP file named product.php or product/details.php and use the $_SERVER\['PATH_INFO'\] variable to figure out what the client requested.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!