2017-01-18 11 views
0

後でWordPressで接続する静的なAMPhtmlファイルを作成しました。Wordpress .htaccessは、カスタムHTMLページを書き換えます。

私の構造は次のとおりです。私は今、サイコーに長い時間のために試してみた、それは私が好きな方法を働くことはありません

/amp/index.html

/amp/subpages.html

それは機能する。私が持っているルートディレクトリ内の.htaccessで

# BEGIN Static AMP 
 
RewriteEngine On 
 
RewriteRule ^index\.html$/[R,L,NC] 
 
RewriteRule ^(.*)\.html$ /$1 [R,L] 
 
# END Static AMP 
 

 
# BEGIN Security 
 
<files wp-config.php> 
 
    order allow,deny 
 
    deny from all 
 
</files> 
 
Options -Indexes 
 
<files ~ "^.*\.([Hh][Tt][Aa])"> 
 
    order allow,deny 
 
    deny from all 
 
    satisfy all 
 
</files> 
 
# END Security 
 

 
# 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 
 

 
#-----------------------------------------------------------------# 
 
# NOTE:               # 
 
# When testing your .htaccess do not use 301 redirects.   # 
 
# Use 302 until finished testing, as the browser will cache 301s. # 
 
#-----------------------------------------------------------------# 
 

 
#-----------------------------------------------------------------------------# 
 
# FLAGS:                  # 
 
# [R] redirect, by default 302, can use [R=301]        # 
 
# [NC] flag causes the RewriteRule to be matched in a case-insensitive manner # 
 
# [L] flag causes mod_rewrite to stop processing the rule set.    # 
 
#-----------------------------------------------------------------------------#

私はこれがやりたいことは http://www.example.com/amp/

http://www.example.com/amp/index.html をリライトすることですと

http://www.example.com/amp/subpages.html http://www.example.com/amp/subpages

に任意の提案ですか?

答えて

0

私自身の質問に答える。

# BEGIN Static AMP 
 
\t <IfModule mod_rewrite.c> 
 
\t \t RewriteEngine On 
 
\t \t RewriteRule ^amp/index\.html$ /amp [R,L,NC] 
 
\t \t # example.com/page will display the contents of example.com/page.html 
 
\t \t RewriteCond %{REQUEST_FILENAME} !-f 
 
\t \t RewriteCond %{REQUEST_FILENAME} !-d 
 
\t \t RewriteCond %{REQUEST_FILENAME}.html -f 
 
\t \t RewriteRule ^(.+)$ $1.html [L,QSA] 
 
\t \t # 301 from example.com/page.html to example.com/page 
 
\t \t RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*\.html\ HTTP/ 
 
\t \t RewriteRule ^(.*)\.html$ /$1 [R=301] 
 
\t \t RewriteRule ^amp/index$ /amp [R=301,L] 
 
\t </IfModule> 
 
# END Static AMP 
 

 
# BEGIN Security 
 
<files wp-config.php> 
 
    order allow,deny 
 
    deny from all 
 
</files> 
 
Options -Indexes 
 
<files ~ "^.*\.([Hh][Tt][Aa])"> 
 
    order allow,deny 
 
    deny from all 
 
    satisfy all 
 
</files> 
 
# END Security 
 

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

 
#-----------------------------------------------------------------# 
 
# NOTE:               # 
 
# When testing your .htaccess do not use 301 redirects.   # 
 
# Use 302 until finished testing, as the browser will cache 301s. # 
 
#-----------------------------------------------------------------# 
 

 
#-----------------------------------------------------------------------------# 
 
# FLAGS:                  # 
 
# [R] redirect, by default 302, can use [R=301]        # 
 
# [NC] flag causes the RewriteRule to be matched in a case-insensitive manner # 
 
# [L] flag causes mod_rewrite to stop processing the rule set.    # 
 
#-----------------------------------------------------------------------------# 
 

 
#-------------------------------------------------------# 
 
# This checks for existing folders (-d) and files (-f): # 
 
# RewriteCond %{REQUEST_FILENAME} !-d     # 
 
# RewriteCond %{REQUEST_FILENAME} !-f     # 
 
#-------------------------------------------------------# 
 

 
#-------------------------# 
 
# .HTACCESS Testing Tool # 
 
# http://htaccess.mwl.be/ # 
 
#-------------------------#