Malik Nabeel Malik Nabeel - 8 months ago 60
PHP Question

how to remove filename from URL?

I have a path like following


I want to remove /getvideo.php and just want the following path


how can i do this.?
I not rewriting my URL , i just want to remove extension only.


File name removal is complex but its possible, but i do this by removing the extension of the file, As my Filename is getvideo.php and i want http://localhost/streamcola/watch So i change my file name to watch.php and remove that .php extension This is done by creating a new file named .htaccess file. I place it with my watch.php file and code of that .htyaccess file is following

RewriteEngine On

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

and hence i get my desired URL..