2017-03-19 1 views
0

私はXAMPP上で動作しているPHPウェブサイトにいくつかの問題があります。問題は、URLを書き換える.htaccessファイルによって引き起こされるはずです。基本的には.htaccessファイルの内容を変更して、 "www。"の書き換え役割を回避するにはどうすればよいですか?サーバー名の前に?

I次のような状況があります。私のCの中へ

:私は、この仮想ホストを宣言した\ xamppの\のapache \ confに\エクストラ\のhttpd-vhosts.confファイル:

<VirtualHost *:80> 
    DocumentRoot "C:/xampp/htdocs/MyProject-Panda" 
    ServerName panda.dev 
</VirtualHost> 

をそして、Cに:\ WINDOWS \ System32 \ Drivers \ Etc \ Hostsにファイル私が定義されていること:

127.0.0.1  panda.dev 

問題は、ブラウザーでpand.devドメイン(私の仮想ホスト)を開こうとすると、自動的にhttp://www.panda.dev/に書き換えられ、サーバーに接続できないと言われています。

は、私はこの問題は、ウェブサイトの.htaccessファイルの一部書き換え役割であるべきだと思うが、私はこのトピックにそうではありませんよ。これは私のの.htaccessコンテンツです:

<IfModule mod_deflate.c> 
    <IfModule mod_filter.c> 
     SetOutputFilter DEFLATE 
     AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php 
    </ifModule> 
    BrowserMatch ^Mozilla/4 gzip-only-text/html 
    BrowserMatch ^Mozilla/4\.0[678] no-gzip 
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html 
    BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html 
    <IfModule mod_setenvif.c> 
     SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip 
    </ifModule> 
</ifModule> 
<IfModule mod_expires.c> 
    ExpiresActive On 
    ExpiresDefault "access plus 7200 seconds" 
    <FilesMatch "\.(ico|icon|jpg|jpeg|png|gif|js|css|swf)$"> 
     ExpiresDefault "access plus 2592000 seconds" 
    </FilesMatch> 
    ExpiresByType text/html "access plus 7200 seconds" 
    ExpiresByType application/xhtml+xml "access plus 7200 seconds" 
</IfModule> 
<IfModule mod_headers.c> 
    Header append Vary User-Agent env=!dont-vary 
    Header set X-UA-Compatible "IE=Edge" 
    <FilesMatch "\.(js|css|gif|png|jpe?g|pdf|xml|oga|ogg|m4a|ogv|mp3|mp4|m4v|webm|svg|svgz|eot|ttf|otf|woff|ico|webp|appcache|manifest|htc|crx|xpi|safariextz|vcf)$" > 
     Header unset X-UA-Compatible 
    </FilesMatch> 
    Header append Vary User-Agent 
    <FilesMatch "\.(ttf|otf|eot|woff|font.css)$"> 
     Header set Access-Control-Allow-Origin "*" 
    </FilesMatch> 
    <FilesMatch "\.(ico|jpe?g|png|gif|swf|css|gz)$"> 
     Header set Cache-Control "max-age=2592000, public" 
    </FilesMatch> 
    <FilesMatch "\.(js)$"> 
     Header set Cache-Control "max-age=2592000, private" 
    </FilesMatch> 
    <FilesMatch "\.(html|htm)$"> 
     Header set Cache-Control "max-age=7200, public" 
    </FilesMatch> 
    # Disable caching for scripts and other dynamic files 
    <FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$"> 
     Header unset Cache-Control 
    </FilesMatch> 
    Header unset ETag 
</IfModule> 

FileETag none 
AddDefaultCharset UTF-8 

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteBase/
    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) 
    RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
    RewriteRule .* – [F,L] 
    RewriteCond %{QUERY_STRING} (\"|%22).*(<|>|%3) [NC,OR] 
    RewriteCond %{QUERY_STRING} (javascript:).*(\;) [NC,OR] 
    RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3) [NC,OR] 
    RewriteCond %{QUERY_STRING} (\;|\'|\"|%22).*(union|select|insert|drop|update|md5|benchmark|or|and|if) [NC,OR] 
    RewriteCond %{QUERY_STRING} (base64_encode|localhost|mosconfig) [NC,OR] 
    RewriteCond %{QUERY_STRING} (boot\.ini|echo.*kae|etc/passwd) [NC,OR] 
    RewriteCond %{QUERY_STRING} (GLOBALS|REQUEST)(=|\[|%) [NC] 
    RewriteRule .* - [E=BadQueryString,F] 

    RewriteRule^- [E=BASE:/PandaOk/] [L] 

    RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ 
    RewriteCond %{HTTPS} off [OR] 
    RewriteCond %{HTTPS}:s on:(s) 
    RewriteRule ^(.*)$ http%1://www.%{HTTP_HOST}/$1 [R=301,L] 

    RewriteCond %{REQUEST_URI} /admin/ 
    RewriteRule .* - [S=2] 

    RewriteRule ^(.*)index\.php$ %{ENV:BASE}$1 [R=301,L] 

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^([a-zA-Z0-9!-/]*)$ %{ENV:BASE} [L] 
</IfModule> 

私はこの書き換え動作を回避するために変更する必要がありますか?

答えて

0

削除(またはコメント)これらの行:

RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ 
RewriteCond %{HTTPS} off [OR] 
RewriteCond %{HTTPS}:s on:(s) 
RewriteRule ^(.*)$ http%1://www.%{HTTP_HOST}/$1 [R=301,L] 
関連する問題