0

現時点では、wordpress .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

ユーザーがhttp://mydomain.com/contact.phpの代わりにhttp://mydomain.com/contactからアクセスできるように書き換えたい contact.php という別の .php ファイルをアップロードしました。

この1 つのファイルのみを書き換えるには、.htaccess ファイルに何を入れる必要がありますか?

4

2 に答える 2

2

以下に示すように、リダイレクト用に 1 行追加するだけです。

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

# END WordPress
于 2013-06-05T22:17:35.827 に答える
1

# BEGIN WordPressこれは WP 関連ではないため、コメントの前に配置する必要があります。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^contact$ /contact.php [L] # /contact rewrite
</IfModule>

# 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
于 2013-06-05T22:18:00.210 に答える