Latox
Latox

Reputation: 4695

htaccess - how to fix this rewrite?

This is our current rewrite:

RewriteRule ^share/([A-z0-9]+)[/{0,1}]?/([A-z0-9]+)[/{0,1}]?$ /mods/share/video.php?video=$1&hash=$2 [L]

Basically, if I visit:

http://www.site.com/share/f7Hje-xxGf/fio2fh92fh9bfh

The page displays a 404 error.

If I remove the - from inbetween the first rewrite, it works fine.

I guess it isn't allowing symbols, how can I fix this?

Upvotes: 0

Views: 44

Answers (1)

rodneyrehm
rodneyrehm

Reputation: 13557

RewriteRule ^share/([A-z0-9]+)[/{0,1}]?/([A-z0-9]+)[/{0,1}]?$ /mods/share/video.php?video=$1&hash=$2 [L]

adding - to the character-match

RewriteRule ^share/([A-z0-9-]+)[/{0,1}]?/([A-z0-9-]+)[/{0,1}]?$ /mods/share/video.php?video=$1&hash=$2 [L]

cleaning the thing up

RewriteRule ^share/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)/?$ /mods/share/video.php?video=$1&hash=$2 [L]

Upvotes: 5

Related Questions