簡體   English   中英

.htaccess - 如何將所有URL重定向到除index.php之外的url.php

[英].htaccess - How to redirect all urls to url.php except index.php

RewriteEngine On    # Turn on the rewriting engine
RewriteRule    .    url.php    [NC,L]    

我正在將所有請求重定向到url.php,但我想保留index.php。

# Turn On ReWrite Engine
RewriteEngine On

# Exclude url.php and index.php from redirecting
RewriteCond %{REQUEST_URI} !^/(index|url)\.php

# Redirect to url.php
RewriteRule . url.php [NC,L]

這就行了:

RewriteEngine On    # Turnon the rewriting engine
RewriteRule ^/index\.php$ - [L]
RewriteRule    .    url.php    [NC,L] 

內部服務器錯誤

服務器遇到內部錯誤或配置錯誤,無法完成您的請求。

請與服務器管理員聯系,告知他們錯誤發生的時間以及您在此錯誤發生之前執行的操作。

服務器錯誤日志中可能提供了有關此錯誤的更多信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM