Htaccess Using RewriteMap with a text file
.htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about htaccess, mod-rewrite, , , .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :I can't use link with *
Example - http://localhost/photo_gallery/public/show_c.html/color-1* The requested URL was not found on this server.
The others work's color-3, wood, etc.
generated map -
map.txttitle id
color-1* 1
color-1** 2
color-3 3
wood 4
color777 5
color-test 6htaccess
RewriteRule ^show_c.html/([-w]+)$ show_c.php?cat=$catcolors:$1 [L]httpd.conf
RewriteMap catcolors "txt:C:wampwwwphoto_gallerypublicmapsmap.txt"
My question. Why the link with * cannot be used.
RewriteRule ^show_c.html/([-w]+)$ show_c.php?cat=$catcolors:$1 [L]
The regex [-w]+ does not match *, so the pattern never matches the requested URL-path and the value is never looked up in the rewrite map.
Try the following instead:
RewriteRule ^show_c.html/([-*w]+)$ show_c.php?cat=$catcolors:$1 [L]
The literal * does not need to be backslash escaped in the regex character class as it carries no special meaning here. (But remember to backslash escape literal dots in other parts of the regex.)
Specifically, the regex [-*w]+ matches 1 or more of the following:- (hyphen), * (asterisk), a-z, A-Z, 0-9 and _ (underscore)
Comments
Post a Comment