LoginSignup
4
2

More than 5 years have passed since last update.

mamp+wp環境でパーマネントリンクがNot Foundになる

Posted at

mampでwpを初めて動かした超初心者です。
パーマネントリンクの設定が上手くいかなかったので、備忘録として。

現象

Post name/%postname%/
が設定されているが、下層ページが全てNot Foundになる。
が、Plainの状態だとリンクは全て繋がる。

問題箇所

「.htaccess」か「mod_rewrite」というのが怪しいと知る。

.htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

問題なし。

しかし.htaccessを動かすためには・・・

<Directory "/Applications/MAMP/xxxx">
    AllowOverride None
</Directory>

noneになっている部分を、AllowOverride allにしなければならなかった。
というわけで、「httpd-vhosts.conf」の中の

<VirtualHost *:80>
    DocumentRoot "/Users/xxxx/xxxxx/wordpress"
    ServerName local-xxxx.com
</VirtualHost>

の後ろに、

<Directory "/Users/xxxx/xxxxx/wordpress">
    AllowOverride all
</Directory>

を書き足して、mampを再起動。

動いた!

「httpd-vhosts.conf」内の記述が足りないだけでした。
省略してもOK!みたいな記事に流されるがまま省略していましたが、大事な箇所だったようです・・・。
なんだったのか後で調べます。

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2