2

これらの .htaccess ルールを使用するhttp://example.com/usernameように、次のようなリンクをリダイレクトしたい:http://example.com/ index.php?id=username

RewriteEngine On    
RewriteBase /    
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com    
RewriteCond %{REQUEST_FILENAME} !-d    
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ([a-z0-9-]+)/? http://example.com?id=$1 [R=301,NC,L]

しかし問題がある。URL はリダイレクトされますが、ブラウザのアドレス バーも変更されます。

アドレスバーを変更せずにリンクを他のリンクにリダイレクトするにはどうすればよいですか?

4

1 に答える 1

1

作業例を次に示します。

RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.co.uk$ [NC,OR]
RewriteCond %{HTTP_HOST} ^www.example.co.uk$
RewriteCond %{REQUEST_URI} !example/
RewriteRule (.*) /foldername/$1 [L]
于 2015-06-04T10:04:34.160 に答える