Hello. I need convert dynamic url to static. I have domainname.com/?m=view&id=2 $_GET['m'] is an page name that will be included in index.php. i.e. include($_GET['m'].".php"); I need to convert url to domainname.com/view/2.html or domainname.com/view/2
Try that should work perfect Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^/view/(.*)$ /index.php?m=view&id=$1 [L] Code (markup):
all code that is written in index.php does't show. And when I echo $_GET['id'] in the view.php - is said Undefined index: id
Try this for domainname.com/view/2 rewrite: RewriteEngine On Options +FollowSymLinks DirectoryIndex index.php RewriteRule ^view/([^/]*)$ /index.php?m=view&id=$1 [L] Code (markup): This should be placed in the .htaccess file of your root directory.