Antworten auf deine Fragen:
Neues Thema erstellen

Antworten zum Thema „Problem mit htaccess alte URL auf neue URL“

alexpreyer

Noch nicht viel geschrieben

Ich verzweifle jetzt schon 3 Tage an einer eigentlich simplen Aufgabe, meine ich zumindest.

Bei meiner Fotogalerie hatte ich ursprünglich mal Links wie diesen:



Um Suchmaschinenfreundlicher zu werden habe ich das ? rausgenommen:

http://www.preyer.net/galerie/index/tags/39-reise

Jetzt kennt leider Google beide URLs und meckert duplicate content an, da beide gehen.
Also wollte ich per rewrite in einer htaccess Datei die eine Variante autmoatisch in die andere umleiten. Ich weiß nicht wieviele Varienten, aufgrund div. Googlefunde ich heute ausprobiert habe. Immer passierte irgendwie gar nichts (hatte natürlich getestet ob das rewrite überhaupt zieht).

Meine letzte Variante war diese:

RewriteEngine On


RewriteCond %{QUERY_STRING} index=(.*)
RewriteRule ^index(.*) /galerie/index?%1

Es passiert einfach nicht. Ich lande immer auf der gleichen URL die ich aufrufe. Wo liegt mein Fehler?

Das Fragezeichen hatte ich auch schon maskiert, sowie div. Parameter in eckigen Klammern dahinter.
 

Espe

Nicht mehr ganz neu hier

AW: Problem mit htaccess alte URL auf neue URL

Ist das überhaupt ein Query-String, wenn das Fragezeichen im Ordnernamen steckt?
 

Espe

Nicht mehr ganz neu hier

AW: Problem mit htaccess alte URL auf neue URL

Möchte vorschlagen, dass du als erstes folgendes in .htaccess kopierst:

Code:
RewriteEngine On
RewriteBase /

# mit und ohne www.
RewriteCond %{HTTP_HOST} ^preyer.net$ [NC]
RewriteRule ^(.*) http://www.preyer.net/$1 [L,R=301]
Dadurch ist erstens duplicate content entfernt:
Code:
http://preyer.net/galerie/index?/tags/39-reise
http://[B]www[/B].preyer.net/galerie/index?/tags/39-reise

und zweites wissen wir, dass du die richtige .htaccess bearbeitest (wenn es funktioniert).

Wenn das soweit funktioniert, versuche doch mal noch folgendes anzuhängen:
Code:
# Ordner index?/ nach index/
RewriteRule ^index?/(.*)$ /index/$1 [R=301,L]
 

alexpreyer

Noch nicht viel geschrieben

AW: Problem mit htaccess alte URL auf neue URL

Möchte vorschlagen, dass du als erstes folgendes in .htaccess kopierst:

Ich muß dazu sagen dass ich eine Ebene höher (wohin preyer.net verweist) eine Joomla Installation habe die folgende .htaccess verwenden:

Code:
AddHandler php5-cgi .php
php_flag register_globals off

##
# @version        $Id: htaccess.txt 21101 2011-04-07 15:47:33Z dextercowley $
# @package        Joomla
# @copyright    Copyright (C) 2005 - 2011 Open Source Matters. All rights reserved.
# @license        GNU General Public License version 2 or later; see LICENSE.txt
##

##
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE!
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
##

## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks

## Mod_rewrite in use.

RewriteEngine On

## Begin - Rewrite rules to block out some common exploits.
# If you experience problems on your site block out the operations listed below
# This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to base64_encode data within the URL.
RewriteCond %{QUERY_STRING} base64_encode[^(]*\([^)]*\) [OR]
# Block out any script that includes a <script> tag in URL.
RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL.
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL.
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Return 403 Forbidden header and show the content of the root homepage
RewriteRule .* index.php [F]
#
## End - Rewrite rules to block out some common exploits.

## Begin - Custom redirects
#
# If you need to redirect some pages, or set a canonical non-www to
# www redirect (or vice versa), place that code here. Ensure those
# redirects use the correct RewriteRule syntax and the [R=301,L] flags.
#
## End - Custom redirects

##
# 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.
#
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
#
# If the requested path and file is not /index.php and the request
# has not already been internally rewritten to the index.php script
RewriteCond %{REQUEST_URI} !^/index\.php
# and the request is for something within the component folder,
# or for the site root, or for an extensionless URL, or the
# requested URL ends with one of the listed extensions
RewriteCond %{REQUEST_URI} /component/|(/[^.]*|\.(php|html?|feed|pdf|vcf|raw))$ [NC]
# and the requested path and file doesn't directly match a physical file
RewriteCond %{REQUEST_FILENAME} !-f
# and the requested path and file doesn't directly match a physical folder
RewriteCond %{REQUEST_FILENAME} !-d
# internally rewrite the request to the index.php script
RewriteRule .* index.php [L]
#
## End - Joomla! core SEF Section.
# Regel für Umleitung (301) von DOMAIN.DE nach www.DOMAIN.DE
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [NE,R=301,L,NC]
Hat das eine Auswirkung?
 

Espe

Nicht mehr ganz neu hier

AW: Problem mit htaccess alte URL auf neue URL

Auswirkung auf?
Was meinst du mit "eine Ebene höher"?

Wenn preyer.net mit Joomla läuft dann ist dieses Verzeichnis das Root-Verzeichnis für preyer.net. Das reicht.


Unten in der .htaccess steht:
Code:
# Regel für Umleitung (301) von DOMAIN.DE nach www.DOMAIN.DE RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [NE,R=301,L,NC]

Das scheint aber nicht zu funktionieren:
Code:
ich rufe auf: http://www.preyer.net/eine-seite.html
entferne www: http://preyer.net/eine-seite.html
lande auf: http://www.preyer.net/index.php


Wurde die htaccess.txt in .htaccess umbenannt? :p
Sind im Backend alle SEO-Einstellungn aktiviert, oder gab es bei einer Einstellung Probleme?
  • Suchmaschinenfreundliche URLs: Ja
  • mod_rewrite nutzen: Ja
  • Dateiendungen an URL fügen: Ja


Erstmal einen Überblick verschaffen :D
 

alexpreyer

Noch nicht viel geschrieben

AW: Problem mit htaccess alte URL auf neue URL

Auswirkung auf?
Was meinst du mit "eine Ebene höher"?
Wenn preyer.net mit Joomla läuft dann ist dieses Verzeichnis das Root-Verzeichnis für preyer.net. Das reicht.

Ja, das meinte ich.
Unten in der .htaccess steht:
Code:
# Regel für Umleitung (301) von DOMAIN.DE nach www.DOMAIN.DE RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [NE,R=301,L,NC]
Das scheint aber nicht zu funktionieren:
Code:
ich rufe auf: http://www.preyer.net/eine-seite.html
entferne www: http://preyer.net/eine-seite.html
lande auf: http://www.preyer.net/index.php
Wurde die htaccess.txt in .htaccess umbenannt? :p
Sind im Backend alle SEO-Einstellungn aktiviert, oder gab es bei einer Einstellung Probleme?
  • Suchmaschinenfreundliche URLs: Ja
  • mod_rewrite nutzen: Ja
  • Dateiendungen an URL fügen: Ja
Die Basics sind natürlich geprüft :p Also, .htaccess hat den richtigen Namen und die Backendeinstellungen sind alle ohne Fehler aktiv.
Dann habe ich also eine zweite Baustelle, mit der Joomla Umleitung :'(

Also nochmal zum Verständnis. Unter preyer.net ist die Joomla Installation mit den Joomla eigenen Regeln wie die URL aussieht. In einem Unterordner der Joomlainstallation liegt die Bildergalerie, die auf der Galerie Piwigo basiert und ihre eigenen Pfadregeln hat. Dort habe ich ja das oben geschilderte Problem mit dem Fragezeichen in der URL.
 
Bilder bitte hier hochladen und danach über das Bild-Icon (Direktlink vorher kopieren) platzieren.
Antworten auf deine Fragen:
Neues Thema erstellen

Willkommen auf PSD-Tutorials.de

In unseren Foren vernetzt du dich mit anderen Personen, um dich rund um die Themen Fotografie, Grafik, Gestaltung, Bildbearbeitung und 3D auszutauschen. Außerdem schalten wir für dich regelmäßig kostenlose Inhalte frei. Liebe Grüße senden dir die PSD-Gründer Stefan und Matthias Petri aus Waren an der Müritz. Hier erfährst du mehr über uns.

Stefan und Matthias Petri von PSD-Tutorials.de

Nächster neuer Gratisinhalt

03
Stunden
:
:
25
Minuten
:
:
19
Sekunden

Neueste Themen & Antworten

Flatrate für Tutorials, Assets, Vorlagen

Zurzeit aktive Besucher

Statistik des Forums

Themen
175.187
Beiträge
2.582.068
Mitglieder
67.257
Neuestes Mitglied
Can Ergin
Oben