shah_ankitb Posted July 14, 2010 Share Posted July 14, 2010 Hello Friends, I'm a new to htaccess. I have one site say http://www.xyz.com I have below problems From To1] http://www.xyz.com/index.php -> http://www.xyz.com2] http://www.xyz.com/index.php?page=contact-us -> http://www.xyz.com/contact-us.html I need conversion FROM to TO. Link to comment Share on other sites More sharing options...
chibineku Posted July 14, 2010 Share Posted July 14, 2010 RewriteEngine On#Translate default page to rootRewriteCond %{THE_REQUEST} ^GET\ .*/index\.(php5|html|php)\ HTTPRewriteRule ^(.*)index\.(php5|html|php)$ /$1 [R=301,L]#Translate http://www.xyz.com/index.php?page=contact-us -> http://www.xyz.com/contact-us.htmlRewriteRule ^/(.*)\.html$ //page=$1 Put that in a file called .htaccess and save it at the webroot. I haven't tested the second one, but it should be ok. Link to comment Share on other sites More sharing options...
shah_ankitb Posted July 14, 2010 Author Share Posted July 14, 2010 Thanks for reply.It's not working may be server issue or need to change in Phpinfo();Below are details:PHP :- 5.2.13Loaded Modules :- mod_rewriteWhat i'm missing over here? Link to comment Share on other sites More sharing options...
chibineku Posted July 14, 2010 Share Posted July 14, 2010 Neither one of them works? Link to comment Share on other sites More sharing options...
wirehopper Posted July 14, 2010 Share Posted July 14, 2010 From To1] http://www.xyz.com/index.php -> http://www.xyz.com2] http://www.xyz.com/index.php?page=contact-us -> http://www.xyz.com/contact-us.html RewriteEngine OnRewriteRule index.php$ / [L]RewriteRule index.php?page=(.*)$ /$1.html Link to comment Share on other sites More sharing options...
Synook Posted July 15, 2010 Share Posted July 15, 2010 Note that .htaccess files and mod_rewrite are Apache server configuration settings and have nothing to do with PHP. They will work even if mod_php is not installed. Link to comment Share on other sites More sharing options...
shah_ankitb Posted July 15, 2010 Author Share Posted July 15, 2010 Thanks for your reply.In the server we have to change anything? because my problem is still not resolved Link to comment Share on other sites More sharing options...
Synook Posted July 16, 2010 Share Posted July 16, 2010 Well, what happens when you try? 500 error? Just doesn't rewrite? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.