简体   繁体   中英

Url Rewriting Error show this error 404

When I upload .htaccess file and show this error 404.. Please tell me how can I solve.

My .htaccess code is here :

RewriteEngine on    
RewriteCond %{REQUEST_FILENAME} !-f     
RewriteCond %{REQUEST_FILENAME} !-d     
RewriteRule ^index$ index.php    
RewriteRule ^news$ news.php

The 404 error message is telling that the requested page is Not Found .

To redirect "/index" to "/index.php" and "/news" to "/news.php" , you can use these directives:

RewriteEngine on
RewriteRule ^(index/?|news/?)+$ $1.php [R=302,NC]

When that code succeed then replace the instance of R=302 with R=301 like [R=301,NC] and save it again. When you messed with R=301 "Permanently Redirected" flag then you need to clear you browser cache before checking.

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