Help with mod-rewrite

by 2 replies
3
I dont have much experience with mod-rewrite and would appreciate any assistance. Im trying to add a new rule to a site with an existing CMS and rule set.

Code:
Options +FollowSymLinks +ExecCGI -Indexes

<IfModule mod_rewrite.c>
  RewriteEngine On

  ## uncomment the following line, if you are having trouble
  ## getting no_script_name to work
  #RewriteBase /

  ## remove trailing slash
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{REQUEST_URI} ^(.+)/$
  #RewriteRule ^(.+)/$  $1 [R=301,L]

  ## turn off index.html, it is for offline mode
  RewriteRule ^.*index.html$ index.php [QSA]

  ## no, so we redirect to our front web controller
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  
  RewriteRule ^(.*)$ index.php [QSA,L]   
  
  RewriteRule slots/(.*)/$ members/slot_display.php?s=$1  

</IfModule>
The last line is what I added, its suppost to match such as site.com/slots/foo/ transfers to site.com/members/slot_display.php?s=$foo. The rest is from the CMS. Im having trouble understanding why my line does not match / redirect. Any assistance would be awesome.
#programming #modrewrite
  • RewriteRule ^slots/(.*)/$ members/slot_display.php?s=$1
    • [ 1 ] Thanks
  • Thanks man,

Next Topics on Trending Feed

  • 3

    I dont have much experience with mod-rewrite and would appreciate any assistance. Im trying to add a new rule to a site with an existing CMS and rule set. Code: Options +FollowSymLinks +ExecCGI -Indexes <IfModule mod_rewrite.c> RewriteEngine On ## uncomment the following line, if you are having trouble ## getting no_script_name to work #RewriteBase / ## remove trailing slash #RewriteCond %{REQUEST_FILENAME} !-d #RewriteCond %{REQUEST_URI} ^(.+)/$ #RewriteRule ^(.+)/$ $1 [R=301,L] ## turn off index.html, it is for offline mode RewriteRule ^.*index.html$ index.php [QSA] ## no, so we redirect to our front web controller RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L] RewriteRule slots/(.*)/$ members/slot_display.php?s=$1 </IfModule> The last line is what I added, its suppost to match such as site.com/slots/foo/ transfers to site.com/members/slot_display.php?s=$foo. The rest is from the CMS. Im having trouble understanding why my line does not match / redirect. Any assistance would be awesome.