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

时间:2016-03-01 14:51:31

标签: .htaccess

我有一组这样的网址:

  

http://www.immvestwolf.de/unternehmen-2-2/uebersicht/jeden-tag-besser/   http://www.immvestwolf.de/unternehmen-2-2/team-old/architekten/   http://www.immvestwolf.de/unternehmen-2-2/uebersicht/ein-team-das-verbindet/

现在,我想将网址中包含/unternehmen-2-2的所有网址重定向到该网页:http://www.immvestwolf.de/unternehmen/

我尝试了几种解决方案但没有效果。例如:

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

有人有想法吗?

完整的htaccess:

<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>`

0 个答案:

没有答案