Tom
Tom

Reputation: 795

rewriterules remove .php in the middle of url

I'm having trouble rewriting url from /video.php/test-video to /video/test-video

I currently use:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
#RewriteRule ^/video/(.*)$ /video.php?/$1 [L]

I already rewrite index.php/url-with-white-list to /url-with-white-list. Now I've had a video.php file that uses url from a database.

I just would like to rewrite video.php/url-of-the-video to video/url-of-the-video to

My rewrite of index.php works but I can't make my rewrite of video.php works.

Any ideas ?

By advance, thanks a lot !

Any suggestion ?

Thanks by advance

Upvotes: 1

Views: 218

Answers (1)

Tom
Tom

Reputation: 795

Solutions :

RewriteCond %{REQUEST_URI}  ^(.*)video/(.*)
RewriteRule (.*)video/(.*)$ /video.php?/$2 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

Upvotes: 1

Related Questions