charlie
charlie

Reputation: 481

include slashes in the URL for htaccess rewrite rule

I have this rewrite rules in my htaccess file:

RewriteRule ^([^/]+)/?$ index.php?id=$1 [QSA]

on index.php i have echo $_GET["id"];

it works fine, so domain.com/services rewrites to domain.com/index.php?id=serviceshowever if i visit

domain.com/services/service1

the echoed variable is showing 404.shtml

what rule would i need to allow slashes?

Upvotes: 0

Views: 192

Answers (1)

Anonymous
Anonymous

Reputation: 12017

It's quite simple. You had set your rule to match anything except slashes. Just allow anything.

RewriteRule ^(.+)/?$ index.php?id=$1 [QSA]

Upvotes: 2

Related Questions