Using Apache on the Red-colored Hat server, I am attempting to rewrite the Link to a member's store on our website from:


With such rules, I'm able to get results basically remember to include an ending slash:

Options -Indexes 
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^store/url/(.*)$ store.php?url=$1
RewriteRule ^(.*)/$ store.php?url=$1 works, but doesn't work.

Getting rid of the slash within the last type of Rewrite code breaks a lot of things. It is possible to method of getting this to operate both without or with that ending slash?

Let's say you've made the slash optional? In addition, you most likely to to specify some thing specific than (.*), because will match. Rather, use a negated character class to specify everything apart from a slash.

RewriteRule ^([^/]*)/?$ store.php?url=$1

Alternately, should you simply want to capture amounts, you should use the \d shorthand class (which fits any digit) together with a [cde] which identifies that a minumum of one digit should be present:


Your attempt using RewriteRule ^(\d+)/?$ store.php?url=$1 fails because that will match any URL path. Make use of a more specific pattern than ^(.*)$, maybe .* to permit only a number of numbers: