Jump to content

Mod rewrite - trailing slash "/" question


umairmasood

Recommended Posts

Hello,

 

Here is what my .htaccess contains:

 

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^.* list.php

 

Now this is the code which is using the keyword "How-I-Met-Your-Mother" in the url http://www.dontwatchvideo.com/How-I-Met-Your-Mother/ to show the relevant videos based on the keyword. It is being done by sending the keyword "How-I-Met-Your-Mother" to a .php page (using $_Get) on my site to process the videos for this keyword.

 

But if I goto http://www.dontwatchvideo.com/How-I-Met-Your-Mother the page shows no videos. No keyword is passed to the $_Get paramater if the trailing slash "/" is not added to the end of the url.

 

Please tell me how to edit the line

RewriteRule ^.* list.php

so that it works without trailing slash "/"

 

Please let me know.

 

Thnx

Link to comment
https://forums.phpfreaks.com/topic/219523-mod-rewrite-trailing-slash-question/
Share on other sites

  • 2 weeks later...

I am not sure if there is a better solution but on my server I write another rule with the slash at the end, it works to add it in same rule by writing (/)? at the end, I think it is like this for your rule:

 

RewriteRule ^.*(/)?$ list.php

 

Unless others have better ideas

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.