htaccess rewrite rule with forward slash error

Hello Experts-

I have an htaccess rewrite rule setup to rewrite urls for model numbers.

It looks like this:

RewriteRule ^([A-Z0-9:-]+).html$ ProductDetails.php?SKU=$1 [NC]

This works great except that some models have a forward slash in them which causes it to look like a new directory. Example model:  123/abc

I tried this rewrite:

RewriteRule ^([A-Z0-9:-^/^]+).html$ ProductDetails.php?SKU=$1 [NC]

which opens the page instead of a no page found, but the css and image files are missing.

How do I allow for a slash in the model?

Thanks for your help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brad HoweDevOps ManagerCommented:
Hi Danjen,

Slash is an illegal character for a file name in all OS's. Lets say the file name is "123/abc".

This is default behaviour for browsers. It would be interpretted as an attempt to browse the file "abc" in the directory "123".

Cannot you not just make this a hyphen such as 123-abc?


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Brad HoweDevOps ManagerCommented:
As per the css and image files missing. This would be a bug in the productdetails.php if productdetails.php can't resolve the path to the css/images.

danjenAuthor Commented:
Thanks - this solution worked.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.