PaperChase
PaperChase

Reputation: 1585

htaccess Rewrite subdirectory to php page

I've successfully rewritten

RewriteRule ^alphabetical alpha.php

So that when anyone comes to www.example.com/alphabetical it loads alpha.php. However, I'm having problems creating a rule so that when someone comes to www.example.com/alphabetical/a it should loa alpha-a.php. This is the rule I've tried that isn't working:

RewriteRule ^alphabetical/a alpha-a.php

Upvotes: 0

Views: 130

Answers (1)

Ravi Bhatt
Ravi Bhatt

Reputation: 3163

put your second more specific rule on top of the the first rule. RewriteRule ^alphabetical/a alpha-a.php RewriteRule ^alphabetical alpha.php

further, you can use a $ at the end to denote an end of url, saying urls ending with 'a'.

Upvotes: 2

Related Questions