hi all...
how to rewrite this url http://mydomain.com/cms.php?cms_id=about to http://mydomain.com/about without any error using .htaccess rewriterule.
pls help me to solve this..

tnx in advnc...

Recommended Answers

All 4 Replies

Hope this helps :)

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ cms.php?cms_id=$1 [L,QSA]

hi mattster.. tnx for ur reply its working fine now....

Just for your information: you can also use PHP to read your URL. Say your .htaccess is like this:

RewriteEngine on

Options -Indexes

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

Everything is redirected to index.php. In index.php, you can use $_SERVER['REQUEST_URI'], for example, to parse the URL and load the file you wish to load.

hi minitauros.. tnx for ur information...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.