Why is this working:
... and this is not?Code:RewriteRule ^disthumbs.php$ pages/front/item_list.php [QSA,L]
Code:RewriteRule ^disthumbs.php$ pages/front/item_list.php [QSA,L,R=301]
| SitePoint Sponsor |



Why is this working:
... and this is not?Code:RewriteRule ^disthumbs.php$ pages/front/item_list.php [QSA,L]
Code:RewriteRule ^disthumbs.php$ pages/front/item_list.php [QSA,L,R=301]
Matt Alexander
Alexander Site Design

matt,
Both have the same (minor) problems but the second one is supposed to show the redirection.1. ^ can only be used for Apache 2.x - it will not match with Apache 1.x because that version requires you to include the leading / of the {REQUEST_URI} string.Code:RewriteRule ^disthumbs.php$ pages/front/item_list.php [QSA,L,R=301]
2. . (in disthumbs.php) needs to be escaped to match ONLY the dot character, otherwise it matches ANY character.
3. We have to assume that there are no extra spaces in your .htaccess lines AND that disthumbs.php exists at the directory level of your .htaccess file. We must further assume that item_list.php exists two levels down in the pages/front/ subdirectory.
Regards,
DK
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator



Thanks dklynn, I'll try that.
Little by little, I improve at this very specific language.
Matt Alexander
Alexander Site Design

matt,
While gross overkill (full regex), Mastering Regular Expressions by Friedl is the "bible" for regex and will tell you everything there is to know - except that only a subset is available in mod_rewrite. Bowen's The Definitive Guide to Apache mod_rewrite is straight to the point but written mostly from the standpoint of modifying httpd.conf (where it should be located, if possible, but this is most often not possible). Therefore, I must recommend my "summarization with examples" which are in the tutorial Article in my signature (and you know where to come to ask questions about the content there).
Regards,
DK
David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
Client and (unpaid) WHB Ambassador
Updated mod_rewrite Tutorial Article (setup, config, test & write
mod_rewrite regex w/sample code) and Code Generator
Bookmarks