简体   繁体   中英

URL rewriting-page not found error

In order to convert my dynamic URL ie www.3idiots.co.in/index.php to static url ie 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.

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 .

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

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

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 .

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]

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

RewriteEngine On

RewriteRule ^index.html$ index.php

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM