Zur Navigation

Produktbewertung im Shop funktioniert nicht mehr

1 herb777

Hallo,

ich versuche schon seit Stunden eine simple Weiterleitung in unserem shop zu realisieren. Seit den Umzug auf einen anderen Server funktioniert die Produktbewertung nicht mehr. Der Link wird richtig erzeugt, zumindest sieht man das, wenn dieser über echo ausgegeben wird. Beim mouseover wird der Link mit .../product_reviews_write/product/artikelbezeichnung.html angezeigt.

In der htaccess steht dieser Eintrag:

RewriteRule ^/?(product_reviews_write|product_reviews|product_reviews_info|advanced_search_result)/product/([^/]*)\.html$ /shop/$1.php?products_id=$2&%{QUERY_STRING} [NC]

Soviel ich nun (als Anfänger) herausgefunden habe, wird einfach der QUERY_STRING nicht angehängt. Finde in der htaccess keinen Eintrag zu Parameter $1 und $2.

Habe nun das probiert:

RewriteCond %{THE_REQUEST} ^(.*)/product_reviews_write/product/(.*)? [NC]
RewriteCond %{QUERY_STRING} products_id=(.+)
RewriteRule ^/?(product_reviews_write)/product/([^/]*)\.html? /shop/product_reviews_write.php?products_id=%1 [L,NC]

Bringt leider auch nicht den gewünschten Erfolg. Es sieht so aus, wie wenn diese Umleitung überhaupt nicht berücksichtigt wird?

Möchte mich bereits im Voraus für die Hilfe bedanken.

Gruß, Herbert

17.02.2014 17:21

2 Jörg Kruse

Den alten Query String kannst du mit dem Flag QSA ("query string append") anhängen:

/shop/$1.php?products_id=$2 [NC,QSA]

Habe nun das probiert:

RewriteCond %{THE_REQUEST} ^(.*)/product_reviews_write/product/(.*)? [NC]
RewriteCond %{QUERY_STRING} products_id=(.+)
RewriteRule ^/?(product_reviews_write)/product/([^/]*)\.html? /shop/product_reviews_write.php?products_id=%1 [L,NC]

products_id=%3 wäre wohl passender, da du, wie ich annehme, den dritten geklammerten Ausdruck aus den RewriteConds referenzieren möchtest.

17.02.2014 17:47

3 herb777

Wow, super schnelle Antwort. Danke!

Leider bringen beide Tipps nichts, es sieht für mich so aus, dass diese Bedingungen nicht gezogen werden. Es gibt noch zwei htaccess in meiner Ordnerstruktur, eine im übergeordneten Ordner und eine in einem Unterordner. Vielleich liegt hier das Problem.

Die hier angeführte liegt im Ordner /shop und sollte eigentlich diejenige sein, die für unseren Shop zur Anwendung kommen sollte.

Es gibt eine weitere htacceess in /shop/includes die aber nur folgenden Code enthält:

<Files *.php>
Order Deny,Allow
Deny from all
</Files>

Kann das der Grund dafür sein, dass wir keine Parameter an den Link dabei haben?

Sorry, aber ich bin neu auf diesem Gebiet ;-)

17.02.2014 20:02

4 Jörg Kruse

Wie sieht denn die komplette URL aus, die aufgerufen wird - die URL kannst du über einen Rechtsklick auf den Link kopieren. Den Domainnamen kannst du ggf. durch example.com ersetzen.

In welchem Verzeichnis befindet sich die erstgenannte .htaccess Datei?

Und kannst du den vollständigen Inhalt dieser .htaccess Datei posten?

17.02.2014 20:23 | geändert: 17.02.2014 20:25

5 herb777

Die erstgenannte htaccess befindet sich im Ordner /htdocs und ist jene von Joomla. Hier der vollständige Text, sind halt viele auskommentiert:

##
# @version $Id: htaccess.txt 5973 2006-12-11 01:26:33Z robs $
# @package Joomla
# @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##
SetEnv TZ Germany/Berlin
AddDefaultCharset UTF-8
#php_flag register_globals on
#php_value register_globals 1
#php_flag magic_quotes_gpc on

#####################################################
# 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.
#
# Only use one of the two SEF sections that follow. Lines that can be uncommented
# (and thus used) have only one #. Lines with two #'s should not be uncommented
# In the section that you don't use, all lines should start with #
#
# For Standard SEF, use the standard SEF section. You can comment out
# all of the RewriteCond lines and reduce your server's load if you
# don't have directories in your root named 'component' or 'content'
#
# If you are using a 3rd Party SEF or the Core SEF solution
# uncomment all of the lines in the '3rd Party or Core SEF' section
#
#####################################################

##### SOLVING PROBLEMS WITH COMPONENT URL's that don't work #####
# SPECIAL NOTE FOR SMF USERS WHEN SMF IS INTEGRATED AND BRIDGED
# OR ANY SITUATION WHERE A COMPONENT's URL's AREN't WORKING
#
# In both the 'Standard SEF', and '3rd Party or Core SEF' sections the line:
# RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
# May need to be uncommented. If you are running your Joomla!/Mambo from
# a subdirectory the name of the subdirectory will need to be inserted into this
# line. For example, if your Joomla!/Mambo is in a subdirectory called '/test/',
# change this:
# RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
# to this:
# RewriteCond %{REQUEST_URI} ^(/test/component/option,com) [NC,OR] ##optional - see notes##
#
#####################################################


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

#
# mod_rewrite in use

RewriteEngine On


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

# RewriteBase /


########## Begin - Joomla! core SEF Section
############# Use this section if using ONLY Joomla! core SEF
## ALL (RewriteCond) lines in this section are only required if you actually
## have directories named 'content' or 'component' on your server
## If you do not have directories with these names, comment them out.
#
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
#RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
#RewriteRule ^(content/|component/) index.php
#
########## End - Joomla! core SEF Section



########## Begin - 3rd Party SEF Section
############# Use this section if you are using a 3rd party (Non Joomla! core) SEF extension - e.g. OpenSEF, 404_SEF, 404SEFx, SEF Advance, etc
#
RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php
#
########## End - 3rd Party SEF Section


# -----> NIMMIT:SEF:B
#RewriteEngine on
#RewriteBase /
#-----> single file no vars
#RewriteRule ^/shop/([^/]*)\.html$ /shop/$1.php?%{QUERY_STRING} [NC]

#-----> one var
#RewriteRule ^/shop/?(product)/([^/]*)\.html$ /shop/product_info.php?products_id=$2&%{QUERY_STRING} [NC]
#RewriteRule ^/shop/?(category)/([^/]*)\.html$ /shop/index.php?cPath=$2&%{QUERY_STRING} [NC]
#RewriteRule ^/shop/?(brand)/([^/]*)\.html$ /shop/index.php?manufacturers_id=$2&%{QUERY_STRING} [NC]

#-----> two vars
#RewriteRule ^/shop/?(category)/(.*)/(product)/([^/]*)\.html$ /shop/product_info.php?cPath=$2&products_id=$4&%{QUERY_STRING} [NC]
#RewriteRule ^/shop/?(brand)/(.*)/(product)/([^/]*)\.html$ /shop/product_info.php?manufacturers_id=$2&products_id=$4&%{QUERY_STRING} [NC]
#-----> Reviews
#RewriteRule ^/shop/?(product_reviews_write|product_reviews|product_reviews_info)/product/([^/]*)\.html$ /shop/$1.php?products_id=$2&%{QUERY_STRING} [NC]
#RewriteRule ^/shop/?(product_reviews_write|product_reviews|product_reviews_info)/category/(.*)/product/([^/]*)\.html$ /shop/$1.php?cPath=$2&products_id=$3&%{QUERY_STRING} [NC]
#RewriteRule ^/shop/?(product_reviews_write|product_reviews|product_reviews_info)/brand/(.*)/product/([^/]*)\.html$ /shop/$1.php?manufacturers_id=$2&products_id=$3&%{QUERY_STRING} [NC]
#-----> products new
#RewriteRule ^/shop/?(products_new)/product/([^/]*)\.html$ /shop/$1.php?products_id=$2&%{QUERY_STRING} [NC]
# -----> NIMMIT:SEF:E



########## 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 set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%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})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits

17.02.2014 20:45

6 herb777

Leider kann ich die URL nicht kopieren, dass wird nicht gestattet. Kann ihn aber hier wiedergeben:

www.example.com/shop/product_reviews_write/product/Gamaschen_Country.html

Dieser wird beim mouseover angezeigt, laut echo Ausgabe von \shop\includes\boxes\reviews.php

echo tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $_GET['products_id'])

wird der Link richtig angezeit.

Der Ordnung halber, hier der Inhalt von der htaccess im Ordner /shop

#Options FollowSymLinks

<IfModule mod_php5.c>
php_flag register_long_arrays on
php_value default_charset UTF-8
php_value output_buffering on
</IfModule>


# -----> NIMMIT:SEF:B
RewriteEngine on
RewriteBase /
#-----> single file no vars
RewriteRule ^([^/]*)\.html$ /shop/$1.php?%{QUERY_STRING} [NC]

#-----> one var
RewriteRule ^/?(product)/([^/]*)\.html$ /shop/product_info.php?products_id=$2&%{QUERY_STRING} [NC]
#RewriteRule ^/?(product)/([^/]*)\.html$ /shop/product_info.php?products_id=5159 [NC]
RewriteRule ^/?(category)/([^/]*)\.html$ /shop/index.php?cPath=$2&%{QUERY_STRING} [NC]
RewriteRule ^/?(brand)/([^/]*)\.html$ /shop/index.php?manufacturers_id=$2&%{QUERY_STRING} [NC]

#-----> two vars
RewriteRule ^/?(category)/(.*)/(product)/([^/]*)\.html$ /shop/product_info.php?cPath=$2&products_id=$4&%{QUERY_STRING} [NC]
RewriteRule ^/?(brand)/(.*)/(product)/([^/]*)\.html$ /shop/product_info.php?manufacturers_id=$2&products_id=$4&%{QUERY_STRING} [NC]
#-----> Reviews
RewriteRule ^/?(product_reviews_write|product_reviews|product_reviews_info|advanced_search_result)/product/([^/]*)\.html$ /shop/$1.php?products_id=$2&%{QUERY_STRING} [NC]
RewriteRule ^/?(product_reviews_write|product_reviews|product_reviews_info)/category/(.*)/product/([^/]*)\.html$ /shop/$1.php?cPath=$2&products_id=$3&%{QUERY_STRING} [NC]
RewriteRule ^/?(product_reviews_write|product_reviews|product_reviews_info)/brand/(.*)/product/([^/]*)\.html$ /shop/$1.php?manufacturers_id=$2&products_id=$3&%{QUERY_STRING} [NC]
#-----> products new
RewriteRule ^/?(products_new)/product/([^/]*)\.html$ /shop/$1.php?products_id=$2&%{QUERY_STRING} [NC]
# -----> NIMMIT:SEF:E

17.02.2014 20:56

7 Jörg Kruse

www.example.com/shop/product_reviews_write/product/Gamaschen_Country.html

Dafür ist die .htaccess Datei im Verzeichnis /shop zuständig

Die darin enthaltene RewriteBase passt allerdings nicht zu den folgenden Rules:

RewriteBase /

... denn die dortigen Muster beginnen ja nicht mit ^/?shop/

Also sollte die Basis so lauten:

RewriteBase /shop/

17.02.2014 21:26

8 herb777

Habe nun im Ordner /shop die RewriteBase auf /shop/ geändert.

Leider bringt auch das nicht den gewünschten Erfolg. Es wird bei diesem Link kein Parameter übergeben? Für diesen Link sollte doch diese Rule zuständig sein, oder?

RewriteRule ^/?(product_reviews_write|product_reviews|product_reviews_info|advanced_search_result)/product/([^/]*)\.html$ /shop/$1.php?products_id=$2&%{QUERY_STRING} [NC]

18.02.2014 08:10

9 Jörg Kruse

Es wird bei diesem Link kein Parameter übergeben?

Welche Parameter sind denn gemeint?

%{QUERY_STRING} ist in deiner Beispiel-URL leer:

www.example.com/shop/product_reviews_write/product/Gamaschen_Country.html

... oder meinst du products_id in der rewriteten URL? wenn ja, wie hast du das getestet, dass dieser Parameter nicht übergeben wird?

18.02.2014 11:10

10 herb777

Also getestet habe ich es, indem ich mir per echo den link anzeigen lasse. Es wird aber in der Shopsoftware der Link irgendwo umgeschrieben.

Der Link wird in /sho/functions/boxes/review.php erstellt.

$info_box_contents[] = array('text' => '<table border="0" cellspacing="0" cellpadding="2"><tr><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $_GET['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 'box_write_review.gif', IMAGE_BUTTON_WRITE_REVIEW) . '</a></td><td class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $_GET['products_id']) . '">' . BOX_REVIEWS_WRITE_REVIEW .'</a></td></tr></table>');

Wenn ich mir nun in der Box für die Bewertungen diesen Teil

echo tep_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'products_id=' . $_GET['products_id']) . '<br>';

anzeigen lassen, dann bekomme ich den richtigen Link samt Paramter angezeigt.

http://www.pferdebedarf.at/shop/product_reviews_write.php?products_id=5161

Was mir nun komisch vorkommt, dass beim mouseover ein anderer Link angezeigt wird. Bekomme es nicht gebacken, kann mir nicht erklären wo das umgeschrieben wird.

Hier wird OsC 2.2-MS2 eingesetzt und das ganze in einer darüberliegender Jommlaversion. Ist halt schon in die Jahre gekommen und habe es sozusagen geerbt ;-)

18.02.2014 13:25