Mizo Games
Mizo Games

Reputation: 189

htaccess rewrite rules show an error in my error log file

I have a website which depends on htaccess rewrite rules, i rewrite my URL's with a sequence like this:

www.example.com/games/car/play/123

Actually there is no directories for:

  1. games
  2. car
  3. play

Everyday i see my error log show tons of error line(s) says:

File does not exist: /home/example.com/public_html/games
File does not exist: /home/example.com/public_html/car
File does not exist: /home/example.com/public_html/play

I don't know why Apache consider these fake directories as an actual real directories? i have in my htaccess these lines of rewrite code:

RewriteEngine On
RewriteBase /

RewriteRule ^games/([a-zA-Z0-9-/]+)/play/(.*)$ details.php?slug=$1&id=$2

Now Apache consider: games/slug/play/id as directories and it's not just a fake URL sequence. Also when i go down for lower page:

www.example.com/games/car And www.example.com/games

It's already exists as URL but not a directory i see an error log says:

File does not exist: /home/example.com/public_html/games/car
File does not exist: /home/example.com/public_html/games

How i can resolve this issue? I have tried everything poosible but still get tons of lines of errors in my error log.

Many thanks (and sorry for my bad English).

Upvotes: 0

Views: 261

Answers (1)

Panama Jack
Panama Jack

Reputation: 24448

Try turning off MultiViews and also add some condition checks.

Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^games/([a-zA-Z0-9-/]+)/play/(.*)$ details.php?slug=$1&id=$2 [L]

Upvotes: 1

Related Questions