This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
gallery2_issues_mod_rewrite [2009/04/01 04:50] ben |
gallery2_issues_mod_rewrite [2013/03/19 05:25] ben [Think I've got it] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Problems with old links to gallery pages before moving to mod_rewrite ===== | ||
Custom mod_rewrite rules in .htaccess (at the top) to fix broken URLs with main.php in them: | Custom mod_rewrite rules in .htaccess (at the top) to fix broken URLs with main.php in them: | ||
Line 16: | Line 17: | ||
Also, http://www.benhall.com/gallery2/main.php/v/ with my re-write rules is broken, need to exclude it for Nothing after the /v/ | Also, http://www.benhall.com/gallery2/main.php/v/ with my re-write rules is broken, need to exclude it for Nothing after the /v/ | ||
- | |||
- | |||
- | ===== Think I've got it ===== | ||
- | |||
- | The "final" lines are as such: | ||
- | |||
- | #This fixes a /v/ with no trailing characters (don't think this would ever really happen) | ||
- | RewriteCond %{REQUEST_URI} /gallery2/main\.php/v/$ | ||
- | RewriteRule . /gallery2/ [R=301,L] | ||
- | |||
- | #This one matches anything after /v/ up until the first forward slash (maybe): | ||
- | RewriteCond %{THE_REQUEST} /gallery2/main\.php/v/([^/]*) | ||
- | |||
- | #Also match for old /f/'s | ||
- | RewriteCond %{THE_REQUEST} /gallery2/main\.php/f/([^/]*) | ||
- | |||
- | #this one does NOT match the "test" gallery, so we can test things... | ||
- | #RewriteCond %{REQUEST_URI} !/gallery2/main.php/v/test | ||
- | RewriteRule . /gallery2/v/%1/ [R=301,L] | ||
- | #I don't have download links, but I think this one may allow download links to work as well: | ||
- | RewriteCond %{REQUEST_URI} /gallery2/main\.php/d/([^/]*/[^/]) | ||
- | RewriteRule . /gallery2/d/%1 [R=301,L] | ||
- | RewriteCond %{REQUEST_URI} /gallery2/main\.php/random | ||
- | RewriteRule . /gallery2/random [R=301,L] | ||
- | |||
- | |||