2017-11-03 12 views
0

私はURLに追加パラメータを追加しようとしています。 は例えば、私はURLを持っている:http://example.com は私がURLにそれを変更したい:http://example.com/this-example/Wordpressリライトまたは.htaccessでURL書き換え

私はこれを行うことができます考えているが、書き換え条件の線に沿ってhtaccessのであるが、私はどのようにわかりませんよこれについて。これは私がここで考えていたものです。

htaccessの

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/
RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . /index.php [L] 
RewriteEngine on 
RewriteRule ^/this-example/(.*)/ /index.php?$1 [L] 
</IfModule> 
Options -Indexes 
+0

をこれも同様にワードプレスまたは独立したURL経由でルーティングされるようになっていますか?あなたはサブディレクトリでwordpressを使いたいですか? –

答えて

1

あなたはこの試みることができます:

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteCond %{THE_REQUEST} !^/this-example [NC] 
    # use your own host here, for me is 192.68.10.10 
    RewriteCond %{HTTP_HOST} 192\.168\.10\.10$ [NC] 
    RewriteRule !^this-example/ /this-example%{REQUEST_URI} [L,R,NE] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^this-example/(.*)$ $1 [L,QSA] 
</IfModule> 

Options -Indexes 
+0

ありがとうございます! mod_rewriteを使わずに解決しました。しかし正直なところ、これはとても便利でした。 – askmeaquestion1234