views:

671

answers:

7

In order to convert my dynamic URL i.e www.3idiots.co.in/index.php to static url i.e www.3idiots.co.in/index.html, I edited my .htccess file and put the following code in it:

RewriteEngine On
RewriteRule ^index.php$ /index.html [R]

when i uploaded this file in the root directory,and try to open the page, I got the error

404 page not found error, www.3idiots.co.in/index.html not found.

A: 
RewriteEngine On

# Send the user to index.html
RewriteRule ^index.php$ /index.html [R]

# Tell the server that index.html really means index.php
RewriteRule ^index.html$ /index.php
Greg
hey greg,thnx for ur concern ....i tried this code,but in browser it s showing www.3idiots.co.in/index.php,but i want it in html
MAX
A: 

Try these rules:

RewriteCond %{THE_REQUEST} ^GET\ /index\.php
RewriteRule ^index\.php$ /index.html [L,R=301]

RewriteRule ^index\.html$ index.php [L]

The first rule redirects every direct request of /index.php externally to /index.html. And the second rule rewrites requests of /index.html internally to /index.php.

Gumbo
hey gumbo....its not working buddy......any other solution do u have in your mind??????????????
MAX
Are you sure mod_rewrite is loaded and working? Have you tried a simpler rule such as `RewriteRule ^ http://example.com/ [R]` to see if it’s working?
Gumbo
ya m sure..but its not working
MAX
I hope you didn’t forget the obligatory `RewriteEngine on`.
Gumbo
+1  A: 

You have to actually have a file named index.html. Right now you don't. The rewriting/redirecting is working fine, you're just redirecting to a non-existent page/file.

I'm a little confused as to what you're actually trying to do. If you just want to move index.php to index.html, rename the file. Rewriting makes it so that if someone tries to open index.php they will be redirected to index.html, but you still have to have an index.html file for them to be redirected to.

Chad Birch
A: 

Are you sure mod rewrite is enabled & working?

1) create an html page called found.html with whatever you want in it, but some text to be sure it's loaded (not a blank page basically) and put this in an file called ".htaccess" :

RewriteEngine on
RewriteBase /
RewriteRule ^find.html$ /found.html [L]

2) upload both your .htaccess and the found.html files in your domain's root

3) Just try to load -www.example.com/find.html (with your real domain of course). If mod_rewrite is available, you should see the content of found.html while browsing find.html (which does not physically exist by the way).

If it does not work, try :

RewriteEngine on
RewriteBase /
RewriteRule ^find.html$ found.html [L]

TopPot
A: 

In the Apache Conf file, you also need to make sure that AllowOverride is set to a value that will allow .htaccess to be processed.

Normally it's AllowOverride all

Chris Henry
A: 

RewriteEngine On

RewriteRule ^index.html$ index.php

RewriteRule ^$index.htm/$ index.php [L]

A: 

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^index.html$ index.php

Try this code...

It will work for your problem /..

Best Of LUck
If it solve your problem..
Visit my site

soumik roy