d-_-b
d-_-b

Reputation: 23181

apache htaccess have certain url matches load a file

How can I make certain url regex matches load one file?

For example:

.com/people, .com/people/john, .com/people/* => all load ./people.php

and

.com/animals, .com/pokemon => both load ./index.php

Upvotes: 0

Views: 50

Answers (1)

Justin Iurman
Justin Iurman

Reputation: 19016

This is a bad idea to have many routes leading to same content (this leads to duplicate content which is bad for referencing)

Anyway, here is the code that provides what you asked (put this code into your htaccess, which has to be in root folder)

Options +FollowSymLinks -MultiViews
RewriteEngine on

RewriteRule ^people/? /people.php [L]
RewriteRule ^(animals|pokemon)$ /index.php [L]

Upvotes: 2

Related Questions