refactor: remove caret from rewrite rules

This commit is contained in:
grandeljay 2023-09-27 10:19:00 +02:00
parent e0ce28b393
commit eed6a415a7
2 changed files with 11 additions and 11 deletions

View file

@ -8,23 +8,23 @@
RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-d
# Page # Page
RewriteRule ^([a-z\-]+)$ /index.php?page=$1 [QSA,L] RewriteRule ([a-z\-]+)$ /index.php?page=$1 [QSA,L]
# Wishlists (My lists) # Wishlists (My lists)
RewriteRule ^wishlists/([0-9]+)$ /index.php?page=wishlists&id=$1 [QSA,L] RewriteRule wishlists/([0-9]+)$ /index.php?page=wishlists&id=$1 [QSA,L]
RewriteRule ^wishlists/([0-9]+)/add$ /index.php?page=wishlists&id=$1&wish_add=true [QSA,L] RewriteRule wishlists/([0-9]+)/add$ /index.php?page=wishlists&id=$1&wish_add=true [QSA,L]
# Wishlist # Wishlist
RewriteRule ^wishlist/([0-9a-f]{40})$ /index.php?page=wishlist&hash=$1 [QSA,L] RewriteRule wishlist/([0-9a-f]{40})$ /index.php?page=wishlist&hash=$1 [QSA,L]
# Blog Post # Blog Post
RewriteRule ^blog/([a-z\-0-9]+)$ /index.php?page=post&slug=$1 [QSA,L] RewriteRule blog/([a-z\-0-9]+)$ /index.php?page=post&slug=$1 [QSA,L]
# API # API
RewriteRule ^api/([a-zA-Z\-0-9=]+)$ /index.php?page=api&module=$1 [QSA,L] RewriteRule api/([a-zA-Z\-0-9=]+)$ /index.php?page=api&module=$1 [QSA,L]
RewriteRule ^api/statistics/([a-zA-Z0-9=]+)$ /index.php?page=api&module=statistics&table=$1 [QSA,L] RewriteRule api/statistics/([a-zA-Z0-9=]+)$ /index.php?page=api&module=statistics&table=$1 [QSA,L]
RewriteRule ^api/url/([a-zA-Z0-9=]+)$ /index.php?page=api&module=url&url=$1 [QSA,L] RewriteRule api/url/([a-zA-Z0-9=]+)$ /index.php?page=api&module=url&url=$1 [QSA,L]
RewriteRule ^api/wishlists/([0-9]+)$ /index.php?page=api&module=wishlists&wishlist_id=$1 [QSA,L] RewriteRule api/wishlists/([0-9]+)$ /index.php?page=api&module=wishlists&wishlist_id=$1 [QSA,L]
RewriteRule ^api/wishlists/([0-9a-f]{40})$ /index.php?page=api&module=wishlists&wishlist_hash=$1 [QSA,L] RewriteRule api/wishlists/([0-9a-f]{40})$ /index.php?page=api&module=wishlists&wishlist_hash=$1 [QSA,L]
</IfModule> </IfModule>

View file

@ -107,7 +107,7 @@ class URL
if (count($parts) >= 2) { if (count($parts) >= 2) {
switch ($parts[0]) { switch ($parts[0]) {
case 'RewriteRule': case 'RewriteRule':
$rewriteRule = \substr($parts[1], 1); $rewriteRule = $parts[1];
$target = $parts[2]; $target = $parts[2];
$regex = str_replace('/', '\/', $rewriteRule); $regex = str_replace('/', '\/', $rewriteRule);