0

I have the following in my .htaccess

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

Which works great to rewrite all the files and directories that do not exist. But now I need to do another more specific rewrite

The condition should be "If the requested URI does not exist AND it ends with attendees/" then Apply RewriteRule ^(.+)$ /rewrite/attendees.php?pages=$1 [L]

How could this be applied?

At first I thought it would be read in order of listing and thus tried:

RewriteCond %{REQUEST_FILENAME} employee   [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /rewrite/attendees.php?pages=$1 [L] 

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

But failed...


SOLVED USING THIS:

RewriteCond %{REQUEST_URI} (employee) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /rewrite/employee.php?pages=$1 [L]   

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /rewrite/index.php?pages=$1 [L]
Cœur
  • 37,241
  • 25
  • 195
  • 267
miturbe
  • 715
  • 4
  • 17
  • possible duplicate of [multiple mod\_rewrite rules in .htaccess](http://stackoverflow.com/questions/10089097/multiple-mod-rewrite-rules-in-htaccess) – djf Aug 05 '13 at 15:20

1 Answers1

0

Just add another RewriteCond:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} attendees/$
RewriteRule ^(.+)$ /rewrite/index.php?pages=$1 [L]
Im ieee
  • 469
  • 3
  • 17