views:

79

answers:

2

Hi,

Please check the attached code.

RewriteEngine on

# If you are having problems or are using VirtualDocumentRoot, uncomment this line and set it to your vBulletin directory.
# RewriteBase /forum/

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^threads/.* showthread.php [QSA]
RewriteRule ^forums/.* forumdisplay.php [QSA]
RewriteRule ^members/.* member.php [QSA]
RewriteRule ^blogs/.* blog.php [QSA]
ReWriteRule ^entries/.* entry.php [QSA]

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]
A: 

I only see this repeated once

RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d

RewriteRule ^.*$ - [NC,L]

you can remove the second occurrence.

The statements are there to resolve your SEO friendly URLs to PHP script files. For example this:

RewriteRule ^threads/.* showthread.php [QSA]

This will take urls like domain.com/threads/something and rewrite for process to showthread.php

Pentium10
Yes, I'm asked why that code is repeated?
Essam
A: 

The first rule is to stop the rewriting process immediately if the requested URL can be mapped to an existing file, symbolic link or directory. The next five rules map the path prefixes to the associated files. But as the L flag is not set for these rules, the rewriting process will not stop but proceed and test the other rules until the next, repeated rule stops it like the first would do.

Gumbo