Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 重写规则以重定向文件夹?_.htaccess - Fatal编程技术网

.htaccess 重写规则以重定向文件夹?

.htaccess 重写规则以重定向文件夹?,.htaccess,.htaccess,我有一组URL,如下所示: 现在我想将URL中带有/unternehman-2-2的所有URL重定向到页面:http://www.immvestwolf.de/unternehmen/ 我尝试了几种解决方案,但都不奏效。例如: 重写规则Unternehman-2-2/(.*)/Unternehman/[L,R=301]` 有人有主意吗 完全访问: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond

我有一组URL,如下所示:

现在我想将URL中带有
/unternehman-2-2
的所有URL重定向到页面:
http://www.immvestwolf.de/unternehmen/

我尝试了几种解决方案,但都不奏效。例如:

重写规则Unternehman-2-2/(.*)/Unternehman/[L,R=301]`

有人有主意吗

完全访问:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)/[0-9]+$ %{REQUEST_URI}/ [QSA,L,R=301]

RewriteRule ^expose/(.*)$ content/index.php?content=expose&query=$1 [L,QSA]

RewriteRule unternehmen-2-2/(.*) unternehmen/ [L,R=301]

#RewriteRule ^unternehmen/darstellung/(.*)$ content/index.php?
content=unternehmen/darstellung&query=$1 [L,QSA]
#RewriteRule ^unternehmen/team/(.*)$ content/index.php?   

content=unternehmen/team&query=$1 [L,QSA]
#RewriteRule ^unternehmen/referenzen/(.*)$ content/index.php?  
content=unternehmen/referenzen&query=$1 [L,QSA]
#RewriteRule ^unternehmen/partner/(.*)$ content/index.php?  
content=unternehmen/partner&query=$1 [L,QSA]
#RewriteRule ^unternehmen/karriere/(.*)$ content/index.php?  
content=unternehmen/karriere&query=$1 [L,QSA]
#RewriteRule ^unternehmen/verbundpartner/(.*)$ content/index.php? 
content=unternehmen/verbundpartner&query=$1 [L,QSA]
#RewriteRule ^unternehmen/$ content/index.php?content=unternehmen&query=$1  
[L,QSA]
#RewriteRule ^unternehmen/(.*)$ content/index.php?  
content=unternehmen&query=$1 [L,QSA]

#RewriteRule ^hausverwaltung/(.*)$ content/index.php?  
content=hausverwaltung&query=$1 [L,QSA]
#RewriteRule ^investment/(.*)$ content/index.php?content=investment&query=$1  
[L,QSA]
#RewriteRule ^kontakt/(.*)$ content/index.php?content=kontakt&query=$1 
[L,QSA]
#RewriteRule ^kontakt2/(.*)$ content/index.php?content=kontakt2&query=$1 
[L,QSA]
#RewriteRule ^vermietung/angebote/(.*)$ content/index.php?  
content=vermietung/angebote&query=$1 [L,QSA]
#RewriteRule ^eigentum/angebote/(.*)$ content/index.php? 
content=eigentum/angebote&query=$1 [L,QSA]

#RewriteRule ^service/vermietung/(.*)$ content/index.php? 
content=service/vermietung&query=$1 [L,QSA]
#RewriteRule ^service/eigentum/(.*)$ content/index.php? 
content=service/eigentum&query=$1 [L,QSA]
#RewriteRule ^service/$ content/index.php?content=service&query=$1 [L,QSA]

RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress


# PROTECT wp-config.php
<files wp-config.php>
 Order deny,allow
 deny from all
</files>

 # PROTECT readme.html
 <Files readme.html>
 Order Allow,Deny
 Deny from all
 Satisfy all
</Files>

# PROTECT liesmich.html für DE Edition
<Files liesmich.html>
 Order Allow,Deny
 Deny from all
 Satisfy all
</Files>

# PROTECT install.php
<Files install.php>
 Order Allow,Deny
 Deny from all
 Satisfy all
 </Files>

# Browser Cachin ON
<IfModule mod_expires.c>
 ExpiresActive on

# Perhaps better to whitelist expires rules? Perhaps.
 ExpiresDefault      "access plus 1 month"

# cache.appcache needs re-requests
# in FF 3.6 (thx Remy ~Introducing HTML5)
 ExpiresByType text/cache-manifest "access plus 0 seconds"

# Your document html
 ExpiresByType text/html "access plus 0 seconds"

# Data
 ExpiresByType text/xml "access plus 0 seconds"
 ExpiresByType application/xml "access plus 0 seconds"
 ExpiresByType application/json "access plus 0 seconds"

# RSS feed
 ExpiresByType application/rss+xml "access plus 1 hour"

# Favicon (cannot be renamed)
 ExpiresByType image/x-icon "access plus 1 week"

# Media: images, video, audio
 ExpiresByType image/gif "access plus 1 month"
 ExpiresByType image/png "access plus 1 month"
 ExpiresByType image/jpg "access plus 1 month"
 ExpiresByType image/jpeg "access plus 1 month"
 ExpiresByType video/ogg "access plus 1 month"
 ExpiresByType audio/ogg "access plus 1 month"
 ExpiresByType video/mp4 "access plus 1 month"
 ExpiresByType video/webm "access plus 1 month"

# HTC files  (css3pie)
 ExpiresByType text/x-component "access plus 1 month"

# Webfonts
 ExpiresByType font/truetype "access plus 1 month"
 ExpiresByType font/opentype "access plus 1 month"
 ExpiresByType application/x-font-woff   "access plus 1 month"
 ExpiresByType image/svg+xml "access plus 1 month"
 ExpiresByType application/vnd.ms-fontobject "access plus 1 month"

# CSS and JavaScript
 ExpiresByType text/css "access plus 1 year"
 ExpiresByType application/javascript "access plus 1 year"
 ExpiresByType text/javascript "access plus 1 year"

 <IfModule mod_headers.c>
 Header append Cache-Control "public"
</IfModule>
</IfModule>

# Deflate Compression by MimeType
<IfModule mod_deflate.c>
<FilesMatch "\.(js|jpg|jpeg|gif|png|css)$">
ExpiresActive on
ExpiresDefault "access plus 1 month"
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>

#Schnittstelle xmlrpc sperren
<FilesMatch "(\.htaccess|\.htpasswd|wp-  
config\.php|liesmich\.html|readme\.html|xmlrpc\.php)$">
order deny,allow
deny from all
</FilesMatch>`

重新启动发动机
重写基/
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_URI}!(.*)/$
重写规则^(.*)/[0-9]+$%{REQUEST_URI}/[QSA,L,R=301]
重写规则^expose/(*)$content/index.php?content=expose&query=$1[L,QSA]
重写规则unternehman-2-2/(*)unternehman/[L,R=301]
#重写规则^unternehmen/darstellung/(*)$content/index.php?
content=unternehmen/darstellung&query=$1[L,QSA]
#重写规则^unternehmen/team/(.*)$content/index.php?
content=unternehmen/team&query=$1[L,QSA]
#重写规则^unternehmen/referencen/(.*)$content/index.php?
content=unternehmen/referencen&query=$1[L,QSA]
#重写规则^unternehmen/partner/(.*)$content/index.php?
content=unternehmen/partner&query=$1[L,QSA]
#重写规则^unternehmen/karriere/(*)$content/index.php?
content=unternehmen/karriere&query=$1[L,QSA]
#重写规则^unternehmen/verbundpartner/(*)$content/index.php?
content=unternehmen/verbundpartner&query=$1[L,QSA]
#重写规则^unternehmen/$content/index.php?content=unternehmen&query=$1
[L,QSA]
#重写规则^unternehmen/(.*)$content/index.php?
内容=卸载和查询=$1[L,QSA]
#重写规则^hausverwaltung/(.*)$content/index.php?
content=hausverwaltung&query=1美元[L,QSA]
#重写规则^investment/(*)$content/index.php?content=investment&query=$1
[L,QSA]
#重写规则^kontakt/(*)$content/index.php?content=kontakt&query=$1
[L,QSA]
#重写规则^kontakt2/(*)$content/index.php?content=kontakt2&query=$1
[L,QSA]
#重写规则^verietung/angebote/(.*)$content/index.php?
content=verietung/angebote&query=$1[L,QSA]
#重写规则^eigentum/angebote/(.*)$content/index.php?
content=eigentum/angebote&query=$1[L,QSA]
#重写规则^service/verietung/(*)$content/index.php?
内容=服务/害虫和查询=$1[L,QSA]
#重写规则^service/eigentum/(.*)$content/index.php?
内容=服务/特征值和查询=$1[L,QSA]
#重写规则^service/$content/index.php?content=service&query=$1[L,QSA]
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#开始WordPress
重新启动发动机
重写基/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/index.php[L]
#结束WordPress
#保护wp-config.php
命令拒绝,允许
全盘否定
#保护自述文件.html
命令允许,拒绝
全盘否定
满足所有
#保护liesmich.html für DE Edition
命令允许,拒绝
全盘否定
满足所有
#PROTECT install.php
命令允许,拒绝
全盘否定
满足所有
#浏览器开玩笑
过期于
#也许最好将过期规则列入白名单?也许。
ExpiresDefault“访问加1个月”
#cache.appcache需要重新请求
#在FF 3.6中(thx Remy~引入HTML5)
ExpiresByType文本/缓存清单“访问加0秒”
#您的文档是html
ExpiresByType text/html“访问加0秒”
#资料
ExpiresByType text/xml“访问加0秒”
ExpiresByType应用程序/xml“访问加0秒”
ExpiresByType应用程序/json“访问加0秒”
#RSS源
ExpiresByType应用程序/rss+xml“访问加1小时”
#Favicon(无法重命名)
ExpiresByType图像/x图标“访问加1周”
#媒体:图像、视频、音频
ExpiresByType image/gif“访问加1个月”
ExpiresByType图像/png“访问加1个月”
ExpiresByType图像/jpg“访问加1个月”
过期按类型图像/jpeg“访问加1个月”
按类型视频/ogg“访问加1个月”过期
ExpiresByType音频/ogg“访问加1个月”
按类型视频/mp4“访问加1个月”过期
过期按类型视频/webm“访问加1个月”
#HTC文件(css3pie)
ExpiresByType文本/x组件“访问加1个月”
#网络字体
ExpiresByType字体/truetype“访问加1个月”
ExpiresByType字体/opentype“访问加1个月”
过期按类型应用程序/x-font-woff“访问加1个月”
ExpiresByType图像/svg+xml“访问加1个月”
ExpiresByType应用程序/vnd.ms-fontobject“访问加1个月”
#CSS和JavaScript
ExpiresByType文本/css“访问加1年”
ExpiresByType应用程序/javascript“访问加1年”
ExpiresByType文本/javascript“访问加1年”
标头附加缓存控制“公共”
#通过MimeType对压缩进行放气
过期于
ExpiresDefault“访问加1个月”
SetOutputFilter放气
#施尼特斯特勒斯佩伦酒店
命令拒绝,允许
全盘否定
`

现在您可以看到完整的htaccess,但我需要一个重写目标,所以:
重写规则^unternehman-2-2 unternehman/unternehman/[L,R=301]
我尝试了:
重写引擎上的规则^unternehman-2-2/unternehman/[L,R=301,NC]
但我遇到了一个500服务器错误:-(
RewriteEngine On
RewriteRule^unternehman-2-2/unternehman/[L,R=301,NC]
应该在单独的行中。是的,我在单独的行中使用了它。。。