Reputation: 934
I think I need 2 rules for this ... but I'm not getting there...
How can I redirect these URLs:
(1) http://example.com/myapi/XXXXXXXX
(2) http://example.com/myapi/XXXXXXXX.json
(3) http://example.com/myapi/XXXXXXXX.xml
XXXXXXXX is alpha-numeric string variable length
(1) Goes to normalPage.php?feed=XXXXXXXX
(2) and (3) go to feeds.php?feed=XXXXXXXX&type=json (or xml)
I have so far:
Options +FollowSymlinks -MultiViews
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.+)/$ /$1 [L]
RewriteRule ^myapi/([^/]+)$ normalPage.php?feed=$1 [L]
RewriteRule ^myapi/([^/]+).([^/]+)$ feeds.php?feed=$1&type=$2 [L]
Upvotes: 0
Views: 29
Reputation: 987
Try modifying the first rule to exclude periods from the pattern. For example:
RewriteRule ^myapi/([^/.]+)$ normalPage.php?feed=$1 [L]
Upvotes: 1