Mod rewrite


I am just starting out using this and thought I had my head around it so was just trying to do the most basic task but not working and I dont understand why.


RewriteEngine On    # Turn on the rewriting engine
RewriteRule ^items-starting-with-a/$   browse_categories.php?search_string=A    [NC,L]    # Handle requests for "A"


Server Error
The requested URL /var/users/userid/ was not found on this server.

manually type in and it delivers the page fine as does

Anyone got any ideas where I am heading wrong here
Any help appreciated
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.

Ray PaseurCommented:
It appears that the Rewrite Rule created a file path instead of a URL.  The URL would start with something like https://  Instead we got something like /var/users/userid/ which appears to be the server file path to the web root.

This article is old, but SitePoint is usually a pretty good learning resource.  Check examples 8, 9, 11.

Also, if you're using a hosting company, ask their tech support for an example.  You are not the first one to ask this question, and it's probably part of their library of Q-n-A!

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
kennedypd1Author Commented:
Hi Ray

Thanks I have worked it out.

I had to change the rule to have a slash infront of the page name like below.

RewriteEngine On    # Turn on the rewriting engine
RewriteRule ^items-starting-with-a/$   /browse_categories.php?search_string=A    [NC,L]    # Handle requests for "A"

Ray PaseurCommented:
Looks good!  Thanks for the points, ~Ray
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
Apache Web Server

From novice to tech pro — start learning today.