1

Trying to show quarantine.country/coronavirus/dashboard/usa/ instead of quarantine.country/coronavirus/dashboard/region/usa/ at our covid-19 dashboard for US, using @anubhava's solution:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /coronavirus/dashboard/

RewriteRule ^region/(.*)$ /$1 [L,NC,R]
  • please let me know why the solution above doesn's seem to have the desired rewrite. Thank you!
anubhava
  • 761,203
  • 64
  • 569
  • 643
Yatko
  • 8,715
  • 9
  • 40
  • 46
  • I have my URL like `https://www.test.com/something/en/home`. Here my code is in directory `something` but from URL i need to remove it. So URL should be `https://www.test.com/en/home`. I tried above rule with `RewriteBase /` but it's not working @yatko – Jitendra Solanki Oct 09 '20 at 16:01

1 Answers1

0

You may use these rules in /coronavirus/dashboard/.htaccess:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /coronavirus/dashboard/

RewriteRule ^(?!region/).*$ region/$0 [L,NC]

This will let you use URL as: https://quarantine.country/coronavirus/dashboard/usa/

anubhava
  • 761,203
  • 64
  • 569
  • 643
  • I have my URL `https://www.test.com/something/en/home`. Here my code is in directory `something` but from URL i need to remove it. So URL should be `https://www.test.com/en/home`. I tried above rule with `RewriteBase /` but it's not working @anubhava – Jitendra Solanki Oct 09 '20 at 15:59
  • Please open a new question then I can probably understand it better to help you out – anubhava Oct 09 '20 at 16:28