开发者

Write a php code to be seo permalink url according to current htaccess

开发者 https://www.devze.com 2023-01-18 15:05 出处:网络
Below is example a famous .htaccess RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FI开发者_C百科LENAME} !-f

Below is example a famous .htaccess

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FI开发者_C百科LENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

What I know here, the result for URL will be

http://domain.com/about.php will be http://domain.com/about/
http://domain.com/contact.php will be http://domain.com/contact/

Example my URL is http://domain.com/page.php?id=1

How to write a code in PHP which the URL will be http://domain.com/page-name/ according to the .htaccess above.


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9]*)/$ /page.php?name=$1 [L]

this is what you search for

http://domain.com/testname/ will be translated to http://domain.com/page.php?name=testname

0

精彩评论

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