How i do rewrite urls the following by .htacess:
"http://www.domain.com/blog/" To "http://www.domain.com/blog.html"
and
"http://www.domain.com/general.php?code2" To "http://www.domain.com/this-is-ilas.html"
Thanks.
How i do rewrite urls the following by .htacess:
"http://www.domain.com/blog/" To "http://www.domain.com/blog.html"
and
"http://www.domain.com/general.php?code2" To "http://www.domain.com/this-is-ilas.html"
Thanks.
This is a simple rule with mod_rewrite
:
Enable mod_rewrite and .htaccess through httpd.conf
and then put this code in your .htaccess
under DOCUMENT_ROOT
directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^blog\.html$ /blog/ [L,NC]
RewriteRule ^this-is-ilas\.html$ /general.php?code2 [L,NC,QSA]
Take a look at mod_rewrite. It will allow you to change how your URLs appear to the user, while still calling the correct script on the backend. This includes masking any PHP urls to display as .html
. A possible solution (though it may need some work; place it in your .htaccess
file):
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^ilas\.html$ general.php?=2
See also: How to rewrite .php to .html with mod_rewrite rules