Zur Navigation

301 problem mal wieder

1 dominik212 (Gast)

hallo joerg ich habe nun versucht meine unterseiten wie folgt in der htacess umzuleiten:


RewriteRule ^/news/en/details/(.*)$ http://www.mallorca-properties.co.uk/news-blog/en/details/$1 [R=301,L]


jedoch klappt das nicht er nimmt nicht die neue änderung von news nach news-blog

Was ist flasch gelaufen?

LG

29.01.2017 15:18

2 Jörg Kruse

In der .htaccess Datei matcht der Ausdruck in einer RewriteRule nur, wenn er am Anfang keinen Slash enthält

Also entweder weglassen:

^news/en/details/(.*)$

... oder optional mit einem ?:

^/?news/en/details/(.*)$

30.01.2017 09:30

3 dominik212 (Gast)

funktioniert leider nicht ich habe diesen code benutzt


RewriteRule ^/?news/en/details/(.*)$ http://www.mallorca-properties.co.uk/blog/en/details/$1 [R=301,L]


und hier kannst du es testen es kommt kein redirect zustande

https://www.mallorca-properties.co.uk/news/en/details/7-thing-to-do-in-cala-dor-mallorca/

30.01.2017 10:00

4 Jörg Kruse

mod_rewite Engine ist aktiviert und mit "RewriteEngine on" eingeschaltet?

Gibt es noch weitere RewriteRules in der .htaccess Datei, die hier dazwischenfunken könnten? Die Weiterleitungs-Rule sollte möglichst weit oben stehen, damit das L-Flag auch zur Geltung kommen kann

Ggf. mal die komplette .htaccess Datei hier posten

30.01.2017 10:10

5 dominik424 (Gast)

here we go :-)


SuPHP_ConfigPath /home/mallorc1/public_html/


RewriteEngine on



RewriteRule ^/?news/en/details/(.*)$ http://www.mallorca-properties.co.uk/blog/en/details/$1 [R=301,L]

RewriteRule ^forum/(.*)$ http://www.mallorca-properties.co.uk/$1 [R=301,L]


RewriteRule ^apartment-in/(.*)$ http://www.mallorca-properties.co.uk/wohnung-in/$1 [R=301,L]

RewriteRule ^villa-in/(.*)$ http://www.mallorca-properties.co.uk/haus-kaufen/$1 [R=301,L]
RewriteRule ^apartment/(.*)$ http://www.mallorca-properties.co.uk/apartments-for-sale-in/$1 [R=301,L]

RewriteRule ^villa/(.*)$ http://www.mallorca-properties.co.uk/villas-for-sale-in/$1 [R=301,L]

<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

<ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>

RewriteCond %{SERVER_PORT} 80 
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

# remove browser bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent

# Set long expire headers for better browser caching
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 30 days"
ExpiresByType text/javascript "access plus 7 days"
ExpiresByType application/x-javascript "access plus 7 days"
ExpiresByType application/javascript "access plus 7 days"
ExpiresByType image/x-icon "access plus 7 days"
ExpiresByType image/png "access plus 3 months"
ExpiresByType image/gif "access plus 3 months"
ExpiresByType image/jpeg "access plus 3 months"
ExpiresByType image/jpg "access plus 3 months"
ExpiresByType application/x-shockwave-flash "access plus 3 months"
# special MIME type for icons
AddType image/vnd.microsoft.icon .ico
ExpiresByType image/vnd.microsoft.icon "access plus 3 months"
</IfModule>

# Permanent URL redirect
Redirect 301 /property-in/santa-maria/ /property-in/santa-maria-del-cami/
Redirect 301 /en/top-locations/cala-dor/ /en/top-locations/cala-dor-majorca/
Redirect 301 /news/en/details/apartmentedificio-olinto-apartments-/ /apartment/edificio-olinto-apartments-bendinat/
Redirect 301 /mallorca-immobilien/ /de/
Redirect 301 /en/villa/son-vida//ksv00083/ /property-in/son-vida/
 

# Permanent URL redirect 
Redirect 301 /news/en/details/gran-folies-luxury-apartments-for-sale https://www.mallorca-properties.co.uk/apartment/Luxury-gran-folies-flats/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !#
RewriteCond %{REQUEST_URI} !/results/en
RewriteCond %{REQUEST_URI} !/results/de
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ https://www.mallorca-properties.co.uk/$1/ [L,R=301]

<IfModule mod_rewrite.c>

        RewriteEngine On
        RewriteBase /

</IfModule>
##END Solspace Static Page Caching: Site #1

Options -Indexes

                    
# Old rewrite rules
#SHAHED ADDED

# secure .htaccess file
<Files .htaccess>
 order allow,deny
 deny from all
</Files>

# Dont list files in index pages
#IndexIgnore *

#-----------------------------------
# EE 404 page for missing pages
# Change the path to the correct file location
#-----------------------------------

ErrorDocument 404 /index.php/global/404

# Simple 404 for missing files
<FilesMatch "(\.jpe?g|gif|png|bmp)$">
  ErrorDocument 404 "File Not Found"
</FilesMatch>

RewriteEngine On

RewriteBase /

# Add a trailing slash to paths without an extension
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
#RewriteRule ^(.*)$ $1/ [L,R=301]

# Remove ee.php
# Uses the "include method"
# http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/(embeds|globals|forum|blog|news|finca-kaufen-in|land-for-sale-mallorca|property-for-sale-in-majorca|import|fincas-for-sale-in|fincas-for-sale-in-mallorca|villas-for-sale-in|haus-kaufen|haus-kaufen-mallorca|feeds|apartments-for-sale-in|mallorca-property-for-sale-bargains|mallorca-luxusimmobilien|neubauprojekte|immobilien-direkt-am-meer|wohnung-in|wohnung-kaufen-mallorca|ferienhaus-mallorca-kaufen|golfplatz-immobilien|eigentumswohnung-mallorca|mallorca-immobilien-schnaeppchen|optimised-search-pages|de|property-in|immobilien-in|villa-in|villa|apartment-in|apartment|mallorca-villas|Save_Search_Form|finca-mallorca|apartments-mallorca|widget_search-results-link|mallorca-villa|widget_moreimages|en|mallorca-immobilien|members|results|property-trends|Immobilienpreisspiegel|real-estate-market-trends|P[0-9]{2,8}) [NC]
RewriteRule ^(.*)$ /index.php?$1 [L]

# Remove IE image toolbar
<FilesMatch "\.(html|htm|php)$">
  Header set imagetoolbar "no"
</FilesMatch>

# -- LG .htaccess Generator End --

# END WordPress

# -- LG .htaccess Generator Start --

# .htaccess generated by LG .htaccess Generator v1.0.0
# http://leevigraham.com/cms-customisation/expressionengine/addon/lg-htaccess-generator/

# secure .htaccess file
<Files .htaccess>
 order allow,deny
 deny from all
</Files>

# Dont list files in index pages
#IndexIgnore *

# EE 404 page for missing pages
ErrorDocument 404 /index.php?/globals/404

# Simple 404 for missing files
<FilesMatch "(\.jpe?g|gif|png|bmp)$">
  ErrorDocument 404 "File Not Found"
</FilesMatch>

RewriteEngine On

RewriteBase /

# Add a trailing slash to paths without an extension
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule ^(.*)$ $1/ [L,R=301]

# Remove ee.php
# Uses the "include method"
# http://expressionengine.com/wiki/Remove_index.php_From_URLs/#Include_List_Method
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/(embeds|news|globals|import|feeds|grundstueck-mallorca|finca-mallorca-kaufen|eigentumswohnung-mallorca|mallorca-immobilien-schnaeppchen|optimised-search-pages|property-in|immobilien-in|villa-in|villa|apartment-in|apartment|mallorca-villas|Save_Search_Form|finca-mallorca|apartments-mallorca|widget_search-results-link|mallorca-villa|property-trends|finca-country-homes|finca-landhaus|widget_moreimages|news|en|de|members|results|test|P[0-9]{2,8}) [NC]
RewriteRule ^(.*)$ /index.php?/$1 [L]

# Remove IE image toolbar
<FilesMatch "\.(html|htm|php)$">
  Header set imagetoolbar "no"
</FilesMatch>

#RewriteRule ^/?$ "http\:\/\/www\.mallorca\-properties\.co\.uk\/en\/" [R=301,L]

# BEGIN CloudFramz Server Optimization
<IfModule mod_mime.c>
    AddType text/css .css
    AddType text/x-component .htc
    AddType application/x-javascript .js
    AddType application/javascript .js2
    AddType text/javascript .js3
    AddType text/x-js .js4
    AddType text/html .html .htm
    AddType text/richtext .rtf .rtx
    AddType image/svg+xml .svg .svgz
    AddType text/plain .txt
    AddType text/xsd .xsd
    AddType text/xsl .xsl
    AddType text/xml .xml
    AddType video/asf .asf .asx .wax .wmv .wmx
    AddType video/avi .avi
    AddType image/bmp .bmp
    AddType application/java .class
    AddType video/divx .divx
    AddType application/msword .doc .docx
    AddType application/vnd.ms-fontobject .eot
    AddType application/x-msdownload .exe
    AddType image/gif .gif
    AddType application/x-gzip .gz .gzip
    AddType image/x-icon .ico
    AddType image/jpeg .jpg .jpeg .jpe
    AddType application/json .json
    AddType application/vnd.ms-access .mdb
    AddType audio/midi .mid .midi
    AddType video/quicktime .mov .qt
    AddType audio/mpeg .mp3 .m4a
    AddType video/mp4 .mp4 .m4v
    AddType video/mpeg .mpeg .mpg .mpe
    AddType application/vnd.ms-project .mpp
    AddType application/x-font-otf .otf
    AddType application/vnd.ms-opentype .otf
    AddType application/vnd.oasis.opendocument.database .odb
    AddType application/vnd.oasis.opendocument.chart .odc
    AddType application/vnd.oasis.opendocument.formula .odf
    AddType application/vnd.oasis.opendocument.graphics .odg
    AddType application/vnd.oasis.opendocument.presentation .odp
    AddType application/vnd.oasis.opendocument.spreadsheet .ods
    AddType application/vnd.oasis.opendocument.text .odt
    AddType audio/ogg .ogg
    AddType application/pdf .pdf
    AddType image/png .png
    AddType application/vnd.ms-powerpoint .pot .pps .ppt .pptx
    AddType audio/x-realaudio .ra .ram
    AddType application/x-shockwave-flash .swf
    AddType application/x-tar .tar
    AddType image/tiff .tif .tiff
    AddType application/x-font-ttf .ttf .ttc
    AddType application/vnd.ms-opentype .ttf .ttc
    AddType audio/wav .wav
    AddType audio/wma .wma
    AddType application/vnd.ms-write .wri
    AddType application/font-woff .woff
    AddType application/vnd.ms-excel .xla .xls .xlsx .xlt .xlw
    AddType application/zip .zip
</IfModule>
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css A31536000
    ExpiresByType text/x-component A31536000
    ExpiresByType application/x-javascript A31536000
    ExpiresByType application/javascript A31536000
    ExpiresByType text/javascript A31536000
    ExpiresByType text/x-js A31536000
    ExpiresByType text/html A3600
    ExpiresByType text/richtext A3600
    ExpiresByType image/svg+xml A3600
    ExpiresByType text/plain A3600
    ExpiresByType text/xsd A3600
    ExpiresByType text/xsl A3600
    ExpiresByType text/xml A3600
    ExpiresByType video/asf A31536000
    ExpiresByType video/avi A31536000
    ExpiresByType image/bmp A31536000
    ExpiresByType application/java A31536000
    ExpiresByType video/divx A31536000
    ExpiresByType application/msword A31536000
    ExpiresByType application/vnd.ms-fontobject A31536000
    ExpiresByType application/x-msdownload A31536000
    ExpiresByType image/gif A31536000
    ExpiresByType application/x-gzip A31536000
    ExpiresByType image/x-icon A31536000
    ExpiresByType image/jpeg A31536000
    ExpiresByType application/json A31536000
    ExpiresByType application/vnd.ms-access A31536000
    ExpiresByType audio/midi A31536000
    ExpiresByType video/quicktime A31536000
    ExpiresByType audio/mpeg A31536000
    ExpiresByType video/mp4 A31536000
    ExpiresByType video/mpeg A31536000
    ExpiresByType application/vnd.ms-project A31536000
    ExpiresByType application/x-font-otf A31536000
    ExpiresByType application/vnd.ms-opentype A31536000
    ExpiresByType application/vnd.oasis.opendocument.database A31536000
    ExpiresByType application/vnd.oasis.opendocument.chart A31536000
    ExpiresByType application/vnd.oasis.opendocument.formula A31536000
    ExpiresByType application/vnd.oasis.opendocument.graphics A31536000
    ExpiresByType application/vnd.oasis.opendocument.presentation A31536000
    ExpiresByType application/vnd.oasis.opendocument.spreadsheet A31536000
    ExpiresByType application/vnd.oasis.opendocument.text A31536000
    ExpiresByType audio/ogg A31536000
    ExpiresByType application/pdf A31536000
    ExpiresByType image/png A31536000
    ExpiresByType application/vnd.ms-powerpoint A31536000
    ExpiresByType audio/x-realaudio A31536000
    ExpiresByType image/svg+xml A31536000
    ExpiresByType application/x-shockwave-flash A31536000
    ExpiresByType application/x-tar A31536000
    ExpiresByType image/tiff A31536000
    ExpiresByType application/x-font-ttf A31536000
    ExpiresByType application/vnd.ms-opentype A31536000
    ExpiresByType audio/wav A31536000
    ExpiresByType audio/wma A31536000
    ExpiresByType application/vnd.ms-write A31536000
    ExpiresByType application/font-woff A31536000
    ExpiresByType application/vnd.ms-excel A31536000
    ExpiresByType application/zip A31536000
</IfModule>
<IfModule mod_deflate.c>
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
    <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon application/json
    <IfModule mod_mime.c>
        # DEFLATE by extension
        AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
    </IfModule>
</IfModule>
<FilesMatch "\.(css|htc|less|js|js2|js3|js4|CSS|HTC|LESS|JS|JS2|JS3|JS4)$">
    FileETag MTime Size
    <IfModule mod_headers.c>
        Header set Pragma "public"
        Header append Cache-Control "public"
    </IfModule>
</FilesMatch>
<FilesMatch "\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|SVGZ|TXT|XSD|XSL|XML)$">
    FileETag MTime Size
    <IfModule mod_headers.c>
        Header set Pragma "public"
        Header append Cache-Control "public"
    </IfModule>
</FilesMatch>
<FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|json|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|woff|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|JSON|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|MPP|OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|WAV|WMA|WRI|WOFF|XLA|XLS|XLSX|XLT|XLW|ZIP)$">
    FileETag MTime Size
    <IfModule mod_headers.c>
        Header set Pragma "public"
        Header append Cache-Control "public"
    </IfModule>
</FilesMatch>

<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>

<ifModule mod_headers.c>
    Header set Connection keep-alive
</ifModule>

# END CloudFramz Server Optimization

RewriteCond %{HTTP_HOST} ^mallorca\-properties\.co\.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mallorca\-properties\.co\.uk$
RewriteRule ^property\-in\/palma\-de\-mallorca\/$ "http\:\/\/www\.mallorca\-properties\.co\.uk\/property\-in\/palma\-oldtown\/\/" [R=301,L]

[Edit Jörg: Code-Block eingefügt]

30.01.2017 10:21 | geändert von Jörg: 30.01.2017 11:02

6 Jörg Kruse

Die Requests beantwortet ein nginx Webserver. Die .htaccess Datei ist aber ein Konfigurationsdatei für den Webserver Apache. nginx hat andere Konfigurationsdateien und auch eine ganz andere Syntax

30.01.2017 11:10

7 dominik424 (Gast)

kann ich mit einem anderen code diese umleitung erzwingen?

30.01.2017 11:29

8 Jörg Kruse

Mit nginx hattee ich bislang nur am Rande zu tun. Ein solcher Redirect wird dort wohl so realisiert:

location ~ /news/en/details/(.*)$ {
    rewrite ^ /blog/en/details/$1?$args permanent;
}

Das muss in die Konfigurationsdatei des betreffenden Hosts, die für gewöhnlich unterhalb von /etc/nginx/sites-enabled/ liegt. Falls du keinen Server, sondern nur einen Webspace gemietet hast, wirst du da aber vermutlich keinen Zugriff drauf haben.

30.01.2017 14:05

Beitrag schreiben (als Gast)

Die Antwort wird nach der Überprüfung durch einen Moderator freigeschaltet.





[BBCode-Hilfe]