HiDayurie Dave
HiDayurie Dave

Reputation: 1807

.htaccess on GoDaddy not working

I have web hosting in GoDaddy.

Call it: http://example.com

I have this below .htaccess

Options -Multiviews
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ /$1.php [L,QSA]

What I want is, when I open http://example.com/about.php will be http://example.com/about <-- without .php extension.

I tried to upload it to the hosting, but it always show error the file not found.

*Are we need to wait for long time to godaddy update the .htaccess?

Upvotes: 0

Views: 44

Answers (1)

hjpotter92
hjpotter92

Reputation: 80649

To remove .php from pages:

RewriteEngine On
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php [NC]
RewriteRule ^ %1 [R=301,L,NC,QSA]

and then, internal redirection to php pages:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f [NC]
RewriteRule ^.*$ $0.php [QSA,L]

Upvotes: 1

Related Questions