.htaccess 如何在altervista论坛上为htaccess重定向添加例外

jdgnovmf  于 2022-11-16  发布在  其他
关注(0)|答案(1)|浏览(122)

我想将所有论坛的页面重定向到maintenace.html,除了misc.php和getcomuni.php,我将此代码添加到.htaccess,但得到错误500。hcaccess语法不正确,删除|\getcomuni.php它工作正常。

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]
jdg4fx2g

jdg4fx2g1#

这是正确的语法

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

相关问题