My link is for another page news.php is :-
href="news?id=etc"
Here I remove .php
after news in href.
I use the below code in my .htaccess file for to remove .php extension:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
and after I click on the link, the URL will be like this after opening of page:
http://localhost/themobilesapp/news?id=15
but it automatically converted into:
http://localhost/themobilesapp/news/?id=15
it adds a slash(/) in the place of .php
after /news
Please help me to remove this slash(/)
This should work for you
RewriteEngine On
RewriteRule ^themobilesapp/news\?id\=([^/]*)$ /themobilesapp/news.php?id=$1 [L]
It will conwert the original URL like:
http://localhost/themobilesapp/news.php?id=15
to
http://localhost/themobilesapp/news?id=15
But from my point of view it'll look beter like this:
http://localhost/themobilesapp/news/id/15
If you like it than use:
RewriteEngine On
RewriteRule ^themobilesapp/news/id/([^/]*)$ /themobilesapp/news.php?id=$1 [L]