0

i am running Ubuntu 18.04 server and php version is 5.6

https://myurl its index.php auto load when some lick other links

https://myurl/deam its not auto fill with php its should be

https://myurl/dream.php enter image description here i did some thing through ht access dont knwo which code block this my ht access code

when i type with .php its work now i want whenever ever link click its auto fill fill with .php how can i do that?

  • Possible duplicate of https://stackoverflow.com/questions/17048796/htaccess-add-php-to-everything-without-an-extension-already – misorude Oct 08 '18 at 11:11
  • 1
    Or https://stackoverflow.com/questions/18018311/put-links-without-file-extension-php Or countless others that could be found with rather little research effort. – misorude Oct 08 '18 at 11:12

2 Answers2

1

You can use .htaccess with Rewrite

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteCond %{REQUEST_FILENAME}\.php ^(.*)\.php(.*)$
RewriteRule .* %1.php?%2 [QSA]
PaulRM
  • 389
  • 4
  • 13
  • thz but how can i use .htaccess –  Oct 08 '18 at 11:34
  • Check is you rewrite module is enabled and in your apache config is ready to process .htaccess directives. Take a look to the answers to the question https://stackoverflow.com/questions/12202387/htaccess-not-working-apache – PaulRM Oct 08 '18 at 13:45
0

https://serverfault.com/a/531587
next time try all answers its help to you

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

## don't touch /forum URIs
RewriteRule ^forums/ - [L,NC]

## hide .php extension snippet

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

# To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]
GHOST
  • 455
  • 6
  • 22