2016-04-30 12 views
1

私のルートフォルダには、index.phpprofile.phpがあります。それが正常に動作しますが、今、私はこのように、あまりにもprofile.phpページのための私のURLを書き換えたい私のexample.com/index.php?a=profile&u=user1から.htaccessでURLからルートフォルダ内のindex.phpと別のページを削除する

index.phpからexample.com/profile&u=user1

RewriteEngine On 
RewriteCond %{request_filename} -f 
RewriteRule ^(.*) $1 [L] 
RewriteRule ^(([^/]*)+)(/([^/]{0,32})(/.+)?)?$ index.php?a=$1&q=$3  [L] 
RewriteRule ^welcome/([^/]+)/?$   index.php?a=welcome    [NC] 
RewriteRule ^page/([^/]+)/?$   index.php?a=page&filter=$1  [NC] 

を書き換えるため

現在、私はこれらのルールを使用しています:example.com/user1

example.com/profile.php?u=user1から

.htaccessを編集してprofile.phpを一緒に書き換えるにはどうすればよいですか?ここでは上記の質問やコメントに基づいて

+0

チェック要求されたURLが含まれている場合は、「&」、「/」、「=」もしそうでなければ、profile.phpにリクエストを書き換えてください。 – Eugeny

+0

@Eugenyそれは私には分かりません... 'index.php'にはこれらのシンボルも含まれています – NineCattoRules

+0

@anubhavaです。この場合、解決策はありませんか? – NineCattoRules

答えて

1

あなたのために働く必要があるルールがあります:「?」のRewriteCondで

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} -f [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule^- [L] 

RewriteRule ^profile/([^/]+)/?$ profile.php?u=$1 [NC,QSA,L] 

RewriteRule ^welcome/([^/]+)/?$ index.php?a=welcome&filter=$1 [NC,QSA,L] 

RewriteRule ^page/([^/]+)/?$ index.php?a=page&filter=$1 [NC,QSA,L] 

RewriteRule ^(([^/]+)+)(/([^/]{0,32})(/.+)?)?$ index.php?a=$1&q=$3 [L,QSA] 
+1

私は本当にあなたに感謝しています:) – NineCattoRules

関連する問題