Write a php code to be seo permalink url according to current htaccess
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
精彩评论