Home > Software design >  how to add exceptions to htaccess redirect on altervista forum
how to add exceptions to htaccess redirect on altervista forum

Time:10-18

i want to redirect all forum's page to maintenace.html except misc.php and getcomuni.php, i added this code to .htaccess but get error 500 .hcaccess incorrect syntax, removing |\getcomuni.php it is working right.

RewriteEngine on
RewriteCond %{REQUEST_URI} !(\maintenance\.html|\.gif|\.jpg|\.png|\misc\.php|\getcomuni\.php)$ [NC]
 
RewriteRule $ /maintenance.html [R=302,L] 

# Some hosts require RewriteBase to make RewriteRules work.
RewriteBase /

# Google SEO workaround for search.php highlights:
# Make this rule the first rewrite rule in your .htaccess!
RewriteRule ^([^&]*)&(.*)$ http://myforum.altervista.org/$1?$2 [L,QSA,R=301]

# Google SEO 404:
ErrorDocument 404 /misc.php?google_seo_error=404

# Google SEO Sitemap:
RewriteRule ^sitemap\-([^./] )\.xml$ misc.php?google_seo_sitemap=$1 [L,QSA,NC]

# Google SEO URL Forums:
RewriteRule ^Forum\-([^./] )$ forumdisplay.php?google_seo_forum=$1 [L,QSA,NC]

# Google SEO URL Threads:
RewriteRule ^Thread\-([^./] )$ showthread.php?google_seo_thread=$1 [L,QSA,NC]

# Google SEO URL Announcements:
RewriteRule ^Announcement\-([^./] )$ announcements.php?google_seo_announcement=$1 [L,QSA,NC]

# Google SEO URL Users:
RewriteRule ^User\-([^./] )$ member.php?action=profile&google_seo_user=$1 [L,QSA,NC]

# Google SEO URL Calendars:
RewriteRule ^Calendar\-([^./] )$ calendar.php?google_seo_calendar=$1 [L,QSA,NC]

# Google SEO URL Events:
RewriteRule ^Event\-([^./] )$ calendar.php?action=event&google_seo_event=$1 [L,QSA,NC]

CodePudding user response:

this is the correct syntax

RewriteCond %{REQUEST_URI} !(maintenance\.html|\.gif|\.jpg|\.png|misc\.php|getcomuni\.php|getsoggetti\.php)$ [NC]
  • Related