0

I am writing a multi-site platform and currently using the following in my virtualhost/.htaccess

RewriteMap sitemap "txt:/home/fb/multimapper/map.txt"
RewriteCond %{HTTP_HOST} (.*) [NC]
RewriteRule (.*) /home/user/public_html/multimapper/sites/${sitemap:%1}/$1 [L]

I want to put the trailing slash (/$1) within the rewrite rule so I can add a universal 404 page (before anyone asks: I don't want to use multiple ErrorDocument 404 entries - it's not feasible for this project).

So adding 404.php...

This: ${sitemap:%1}/$1 [L]

Becomes: ${sitemap:%1/|404.php?catch=}$1 [L]

EG.

RewriteMap sitemap "txt:/home/fb/multimapper/map.txt"
RewriteCond %{HTTP_HOST} (.*) [NC]
RewriteRule (.*) /home/user/public_html/multimapper/sites/${sitemap:%1/|404.php?catch=}$1 [L]

Problem is, ${sitemap:%1/ fails. Even if I backslash ${sitemap:%1\/

Does anyone have any ideas what I'm doing wrong?

Many thanks

woostar
  • 1
  • 1
  • Did you mean `${sitemap:%1|/404.php?catch=}$1` ? – Capsule Jul 28 '19 at 23:10
  • Hi Capsule. No. I want to redirect to either /home/user/public_html/multimapper/sites/%1/$1 or /home/user/public_html/multimapper/sites/404.php?catch=$1 - I do not want the slash in 404.php?catch=/$1 – woostar Jul 29 '19 at 01:42
  • Well, you'll have to find another way because you can't have that `/` next to `%1`, but what you could do is add it to your every entry of your map. – Capsule Jul 29 '19 at 03:11

0 Answers0