0

I know am re requesting the question which are already asked before but i tried all the posts and did all the research but still am unable to over come the problem i tried to put the below second snip first to htaccess in www directory and as well as folder directory the link of the page later i added the small snip it to the htaccess also but still its not working very disappointed my hosting provider is Godaddy if i add .php it works

htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php

second

Options -MultiViews
RewriteEngine On
RewriteBase /

# remove .php; use THE_REQUEST to prevent infinite loops
RewriteCond %{HTTP_HOST} ^www\.elmorfeo\.com
RewriteCond %{THE_REQUEST} ^GET\ (.*)\.php\ HTTP
RewriteRule (.*)\.php$ $1 [R=301]

# remove index
RewriteRule (.*)index$ $1 [R=301]

# remove slash if not directory
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} /$
RewriteRule (.*)/ $1 [R=301]

# add .php to access file, but don't redirect
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) $1\.php [L]
Shaik
  • 930
  • 1
  • 20
  • 48
  • Perhaps `mod-rewrite` isn't enabled on your server. – Amit Verma Jan 19 '18 at 06:18
  • @starkeen How can i do that thanks for the reply – Shaik Jan 19 '18 at 06:19
  • Read this post https://stackoverflow.com/questions/7337724/how-to-check-whether-mod-rewrite-is-enable-on-server – Amit Verma Jan 19 '18 at 06:21
  • i see godaddy says it is enabled on all linux hosting https://in.godaddy.com/help/how-do-i-use-mod-rewrite-899 still i will check the above link – Shaik Jan 19 '18 at 06:22
  • i added like this to my root directory file of htaccess ` 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] AllowOverride All ` not working still – Shaik Jan 19 '18 at 06:26
  • Where is this .htaccess located? Is `snoozi-cut` a real directory? – anubhava Jan 19 '18 at 06:53
  • SORRY FOR LATE REPLY both places – Shaik Jan 19 '18 at 11:13

2 Answers2

0

Following one works for me

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]
Almani
  • 185
  • 10
  • thanks for the reply but still it show 404 error http://elmorfeo.com/snoozi-cut/product1 – Shaik Jan 19 '18 at 06:20
0

I found the answer that was all the above written ware correct but godaddy Cpanel there is no option to show hidden files i accessed it via ftp i found the original the correct htaccess file i did the changes there problem solved

Shaik
  • 930
  • 1
  • 20
  • 48