快轉到主要內容

Apache

5 Tips on Creating Redirects in .htaccess

5 Tips on Creating Redirects in .htaccess

·350 字·2 分鐘
Per-directory rewrites need rewriting within <Directory> sections or .htaccess files, which introduces some complexity. However, if you only have permission to modify files, you must know how to put redirects in .htaccess files with RewriteRule. 1RewriteEngine on 2RewriteRule ^/index\.html$ /index.php [L] A RewriteRule consists of three arguments separated by spaces. The arguments are Pattern: which incoming URLs should be affected by the rule, ex ^/index\.html$; Substitution: where should the matching requests be sent, ex /index.php; [flags]: options affecting the rewritten request, ex [L]. Here are 5 tips for creating redirects in .htaccess files.
修復a2ensite 報錯 Site does not exist

修復a2ensite 報錯 Site does not exist

·208 字·1 分鐘
給ubuntu主機配置一個子域名的時候,發現用 a2ensite 居然報錯了!明明看了好些教程,比如這個,這個,都是講的差不多的東西,我都完全照著做,怎麼我一運行這個命令就報錯ERROR呢 = 3 = 網上找了一下沒什麼特別有用的,於是還是去看相關文件,終於解決了。原來是新版本的配置文件都必須採用 *.conf命名方式,也就是說要a2ensite filename.conf因為 /etc/apache2/apache2.conf 文件中的以下代碼片段: