导入网站到xampp:htaccess更改

时间:2013-01-25 12:00:28

标签: .htaccess joomla xampp

我有一个Joomla-Website运行,它也使用.htaccess来生成SEO友好的URL。由于升级,我想在第一步将网站导入xampp。这适用于欢迎页面。但是,如果我从菜单中选择一个链接,我总会收到“找不到对象”的错误。这是由.htaccess文件引起的。我已经以某种方式将其从www.mypage.com改编为localhost / mypage。

这是常规网站的.htaccess的样子:

RewriteEngine on

RewriteCond %{HTTP_HOST} !^www\.mypage\.de$
RewriteRule ^(.*)$ http://www.mypage.de/$1 [L,R=301]

########## Begin - Rewrite rules to block out some common exploits
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]

#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update Your Joomla! Directory (just / for root)

RewriteBase /

########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section

现在我必须更改它,以便与localhost / mypage而不是www.mypage.de一起使用。我不熟悉.htaccess所以如果有人能分辨出错误的来源以及必须在这里进行哪些更改,那就太棒了。

谢谢:)

1 个答案:

答案 0 :(得分:0)

我发现它是如何运作的:

RewriteEngine on

########## Begin - Rewrite rules to block out some common exploits
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
RewriteRule ^(.*)$ index.php [F,L]

#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update Your Joomla! Directory (just / for root)

RewriteBase /mypage

########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section

关键是将RewriteBase更改为/ mypage。

除此之外我删除了这部分:

RewriteCond %{HTTP_HOST} !^www\.mypage\.de$
RewriteRule ^(.*)$ http://www.mypage.de/$1 [L,R=301]

因为它只适用于网络上富有成效的网站。