<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Apache on 瓶子裡的小狐狸</title>
    <link>https://szeching.com/tags/apache/</link>
    <description>Recent content in Apache on 瓶子裡的小狐狸</description>
    <generator>Hugo</generator>
    <language>zh-Hant</language>
    <lastBuildDate>Fri, 04 Aug 2023 11:48:09 +0000</lastBuildDate>
    <atom:link href="https://szeching.com/tags/apache/rss" rel="self" type="application/rss+xml" />
    <item>
      <title>5 Tips on Creating Redirects in .htaccess</title>
      <link>https://szeching.com/5-tips-on-creating-redirects-in-htaccess/</link>
      <pubDate>Fri, 04 Aug 2023 11:48:09 +0000</pubDate>
      <guid>https://szeching.com/5-tips-on-creating-redirects-in-htaccess/</guid>
      <description>&lt;p&gt;Per-directory rewrites need rewriting within &lt;code&gt;&amp;lt;Directory&amp;gt;&lt;/code&gt; sections or &lt;code&gt;.htaccess&lt;/code&gt; files, which introduces some complexity. However, if you only have permission to modify files, you must know how to put redirects in &lt;code&gt;.htaccess&lt;/code&gt; files with &lt;code&gt;RewriteRule&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-apache&#34; data-lang=&#34;apache&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt;1&lt;/span&gt;&lt;span&gt;&lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;RewriteEngine&lt;/span&gt; &lt;span style=&#34;color:#ff79c6&#34;&gt;on&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span style=&#34;white-space:pre;-webkit-user-select:none;user-select:none;margin-right:0.4em;padding:0 0.4em 0 0.4em;color:#7f7f7f&#34;&gt;2&lt;/span&gt;&lt;span&gt;&lt;span style=&#34;color:#8be9fd;font-style:italic&#34;&gt;RewriteRule&lt;/span&gt; ^/index\.html$ &lt;span style=&#34;color:#f1fa8c&#34;&gt;/index.php&lt;/span&gt; [L]&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;A RewriteRule consists of three arguments separated by spaces.&lt;/p&gt;&#xA;&lt;p&gt;The arguments are&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;strong&gt;Pattern&lt;/strong&gt;: which incoming URLs should be affected by the rule, ex &lt;code&gt;^/index\.html$&lt;/code&gt;;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;Substitution&lt;/strong&gt;: where should the matching requests be sent, ex &lt;code&gt;/index.php&lt;/code&gt;;&lt;/li&gt;&#xA;&lt;li&gt;&lt;strong&gt;[flags]&lt;/strong&gt;: options affecting the rewritten request, ex &lt;code&gt;[L]&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Here are 5 tips for creating redirects in &lt;code&gt;.htaccess&lt;/code&gt; files.&lt;/p&gt;</description>
    </item>
    <item>
      <title>修復a2ensite 報錯 Site does not exist</title>
      <link>https://szeching.com/a2ensite-error-site-does-not-exist/</link>
      <pubDate>Thu, 04 Dec 2014 07:44:23 +0000</pubDate>
      <guid>https://szeching.com/a2ensite-error-site-does-not-exist/</guid>
      <description>&lt;p&gt;給ubuntu主機配置一個子域名的時候，發現用 a2ensite 居然報錯了！明明看了好些教程，比如&lt;a href=&#34;https://wiki.ubuntu.org.cn/Apache%E8%99%9A%E6%8B%9F%E4%B8%BB%E6%9C%BA%E6%8C%87%E5%8D%97&#34; target=&#34;_blank&#34;&gt;這個&lt;/a&gt;，&lt;a href=&#34;https://songup.diandian.com/post/2011-09-13/4996309&#34; target=&#34;_blank&#34;&gt;這個&lt;/a&gt;，都是講的差不多的東西，我都完全照著做，怎麼我一運行這個命令就報錯ERROR呢 = 3 =&lt;/p&gt;&#xA;&lt;p&gt;網上找了一下沒什麼特別有用的，於是還是去看相關文件，終於解決了。原來是新版本的配置文件都必須採用 &lt;code&gt;*.conf&lt;/code&gt;命名方式，也就是說要&lt;code&gt;a2ensite filename.conf&lt;/code&gt;因為 &lt;code&gt;/etc/apache2/apache2.conf&lt;/code&gt; 文件中的以下代碼片段：&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
