How can i show the given page insted of main index file?
in my url https://learnpk.xyz/view/88
it shows https://learnpk.xyz/index.php
but
i want to show page https://learnpk.xyz/view.php
i am using below commands in .htaccess
file.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(. )$ index.php?url=$1 [QSA,L]
CodePudding user response:
You can try these rules in your site root .htaccess:
RewriteEngine On
# show /view.php for /view/88 provided .php file exists
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteRule ^([^/] )(?:/|$) $1.php [L]
# rewrite all non-files, non-directories to /index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(. )$ index.php?url=$1 [QSA,L]