开发者

code website in php with sef url's

开发者 https://www.devze.com 2023-01-30 05:34 出处:网络
How can I make the custom core php code website to show sef url. I mean to say how the coding technique should be altered in-order to make the site to have sef URL\'s.

How can I make the custom core php code website to show sef url. I mean to say how the coding technique should be altered in-order to make the site to have sef URL's.

I will elaborate...

suppose my php calls only the index.php file with some parameters to redirect to the page

/index.php?tas开发者_高级运维k=show_page2

I want this to make

/page2


Use Apache's mod_rewrite module. It allows you to specify rules which map arbitrary request URIs to the real files and parameters you want to handle them.

For example, in a .htaccess file or Apache's httpd.conf:

RewriteEngine On
RewriteRule page2 index.php?task=show_page2 [L]

You do not have to change any of your PHP code as this happens at the web server level, before PHP is invoked.

0

精彩评论

暂无评论...
验证码 换一张
取 消