View Full Version : .htaccess problem
02-16-2006, 06:03 PM
I have this in my .htaccess
RewriteRule /resorts/([A-Z]+) /resort-info.php?resort=$1 [PT,L]
the file is in a folder on the domain called /new/
I expected that when I type in www.mydomain.com/new/resorts/Algarve to get directed to www.mydomain.com/new/resort-info.php?resort=Algarve, but I get a 404. Not sure what the problem is.
02-16-2006, 07:12 PM
You shouldn't have a / at the start and A-Z only matches uppercase.
I also added /? so you can have an optional trailing slash (you may want to remove this) and ^ and $ to stop people adding extra stuff before and after the matched part (/new/ isn't included in any matching as long as the .htaccess file is in the /new/ directory).
RewriteRule ^resorts/([A-Za-z]+)/?$ /resort-info.php?resort=$1 [PT,L]
You probably don't need the PT flag, but you might.
02-17-2006, 10:32 AM
Thats great but now my css and images dont work.
02-17-2006, 10:57 AM
Sorted those out but its not liking it if theres a space in the name eg /resorts/Costa%20Blanca
RewriteRule ^resorts/([A-Za-z0-9\%\_]+)/?$ /new/resort-info.php?resort=$1 [PT]
RewriteRule ^resorts/([A-Za-z0-9.\.\-\_]+)?$ /new/$1 [PT]
02-17-2006, 11:04 AM
Looks like I was being too clever ;) it was looking for a space not %20
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.