.htaccess file is not working on go daddy server

2019-05-03 12:22发布

问题:

I have a website that is hosted on Godaddy server. For SEO I have made all the rule free from .php extension. for url rewrite i am using .htaccess file

.htaccess file is running fine on local server that is XAMPP, but on live server (godaddy server ) it is not working.

I have no idea about .htaccess file code

.htaccess file content is

RewriteEngine On
Options +MultiViews

回答1:

i have found answer myself

Options +FollowSymLinks -MultiViews 
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

## hide .php extension
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L,NC]

## To internally redirect /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]


回答2:

Maybe # there is a issue with directory settings, try placing a empty .htaccess file with RewriteEngine # or it's because of GoDaddy's setup. add Apache httpd.conf file: AllowOverride FileInfo Options" file to root directory.