下午好,晚上好,早上好或者晚上好。 我有一個問題,我無法解決幾天。 我正在從httpd 2.2遷移到httpd 2.4。它接縫,重寫模式不起作用。但可能是我錯了,那是我工作不夠好。從httpd 2.2遷移到httpd 2.4。國防部重寫返回錯誤404
我使用的是fedora 21.從另一臺服務器遷移。 我使用yum安裝了mariadb httpd。 禁用SELinux的
chnged了原來的httpd.conf這樣:
LoadModule usertrack_module modules/mod_usertrack.so
LoadModule speling_module modules/mod_speling.so
LoadModule file_cache_module modules/mod_file_cache.so
Include conf.modules.d/*.conf
Include conf.d/*.conf
ServerName inyure.ua
ServerTokens OS
ServerRoot "/etc/httpd"
Listen 80
Timeout 120
KeepAlive On
User apache
Group apache
RewriteEngine On
ServerAdmin root[email protected]
DocumentRoot "/var/www"
AddDefaultCharset UTF-8
EnableSendfile on
ErrorLog "logs/error_log"
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /var/www/html >
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
LogLevel warn
Alias /error/ "/var/www/error/"
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
<IfModule mod_negotiation.c>
<IfModule mod_include.c>
<Directory "/var/www/error">
AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en es de fr
ForceLanguagePriority Prefer Fallback
</Directory>
</IfModule>
</IfModule>
<Files ".ht*">
Require all granted
</Files>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html
ErrorLog /var/www/html/error.log
CustomLog /var/www/html/access.log combined
<Directory />
#Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
將有一對夫婦的網站,但首先我需要遷移的至少一個。 我的.htaccess文件:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?inyure.kiev.ua
RewriteRule (.*) http://inyure.ua/ua/ [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.)?inyure.computers.net.ua
RewriteRule (.*) http://inyure.ua/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.)?shop.inyure.kiev.ua
RewriteRule (.*) http://inyure.ua/ua/ [R=301,L]
RewriteRule ^modules/users/hybridauth/$ - [L]
RewriteRule ^admin/* - [L]
RewriteRule ^([\w]+)/news/seminar-new/?$ /$1/news/seminar/?%{QUERY_STRING} [R=301,L]
RewriteRule ^([\w]+)/([\w\d_-]+)$ /$1/$2/?%{QUERY_STRING} [R=301,L]
RewriteRule ^([\w]+)/([\w\d_-]+)/$ /index.php?xlang=$1&type=$2&%{QUERY_STRING} [L]
RewriteRule ^([\w]+)/([\w\d_-]+)/([\w\d,=;_-]+)$ /$1/$2/$3/?%{QUERY_STRING} [R=301,L]
RewriteRule ^([\w]+)/([\w\d_-]+)/([\w\d,=;_-]+)/$ /index.php?xlang=$1&type=$2&child=$3&%{QUERY_STRING} [L]
RewriteRule ^([\w]+)/([\w\d_-]+)/([\w\d,=;_-]+)/([\w\d,=;_-]+)$ /$1/$2/$3/$4/?%{QUERY_STRING} [R=301,L]
RewriteRule ^([\w]+)/([\w\d_-]+)/([\w\d,=;_-]+)/([\w\d,=;_-]+)/$ /index.php?xlang=$1&type=$2&child=$3¶m1=$4&%{QUERY_STRING} [L]
RewriteRule ^([\w]+)/([\w\d_-]+)/([\w\d,=;_-]+)/([\w\d,=;_-]+)/([\w\d,=;_-]+)$ /$1/$2/$3/$4/$5/?%{QUERY_STRING} [R=301,L]
RewriteRule ^([\w]+)/([\w\d_-]+)/([\w\d,=;_-]+)/([\w\d,=;_-]+)/([\w\d,=;_-]+)/$ /index.php?xlang=$1&type=$2&child=$3¶m1=$4¶m2=$5&%{QUERY_STRING} [L]
RewriteRule ^([\w]+)$ /$1/?%{QUERY_STRING} [R=301,L]
RewriteRule ^([\w]+)/$ /index.php?xlang=$1&%{QUERY_STRING} [L]
RewriteRule ^$ /index.php?%{QUERY_STRING} [L]
php_flag magic_quotes_gpc Off
php_flag allow_url_include off
AddDefaultCharset utf-8
Order Deny,Allow
Allow from all
php_value upload_max_filesize 200M
php_value post_max_size 200M
php_value max_execution_time 200
php_value max_input_time 200
# Caching of images
<FilesMatch "\.(jpg|png|gif|js|css|ico|swf)$">
Header set Expires "Thu, 31 Dec 2037 23:55:55 GMT"
Header set Cache-Control "max-age=315360000"
</FilesMatch>
所以,當我去http://inyure.ua 國防部重寫改變URL來http://inyure.ua/ua 後來阿帕奇給出錯誤404
如果我改變.htaccess文件的名稱到另外一個字符串添加到主配置
AccessFileNAme /var/www/html/config
國防部重寫給我「UA /」三次
http://inyure.ua/ua/ua/ua/
和Apache給出了一個錯誤404
我想一切從的.htaccess移動到主配置,以虛擬主機的指令。
因爲我對一個bug有紅色here | and here | and here
但後來我得到了「ua /」三次,再次發生err404。
任何人都可以幫助我請求:)最好的問候。