質問

持っているdrupalのmod_rewrite式に非常に迅速な修正が必要です

  RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$ 
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

しかし、getのサブドメインの値もリダイレクトする必要があるので、次のものが必要になります。

  RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$ 
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^(.*)$ index.php?subdomain=THE SUBDOMAIN HERE&q=$1 [L,QSA]

それを行う方法がわからない、助けてください!

役に立ちましたか?

解決

これをもう一度試してください。何らかの理由で、コードが適切にレンダリングされません。

RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteCond %{HTTP_HOST} ^(.*)\.mydomain\.com$
RewriteRule ^(.*) index.php?subdomain=%1&q=1 [L,QSA]

ここで見つけたいくつかのフォーラム投稿に基づいています。

他のヒント

クエリ文字列にサブドメインは本当に必要ありません。

サブドメインは、PHPの$ _SERVER ['SERVER_NAME']にあります。

PHPのドキュメントは次のように述べています。

'SERVER_NAME'
    The name of the server host under which the
    current script is executing. If the script
    is running on a virtual host, this will be
    the value defined for that virtual host. 
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top