Avatar of kennedypd1
kennedypd1

asked on 

Mod rewrite

HI

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.

.htaccess

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

URL
http://domain.com/items-starting-with-a/

Server Error
The requested URL /var/users/userid/domain.com/htdocs/browse_categories.php was not found on this server.

Checked
manually type in domain.com/browse_categories.php and it delivers the page fine as does domain.com/browse_categories.php?search_string=A

Anyone got any ideas where I am heading wrong here
Any help appreciated
Paul
Apache Web ServerRegular ExpressionsWeb ServersPHP

Avatar of undefined
Last Comment
Ray Paseur
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of kennedypd1
kennedypd1

ASKER

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"

Cheers
Paul
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Looks good!  Thanks for the points, ~Ray
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo