Conflit htaccess Joomla / phpBB-SEO : isoler le redirections dans le htaccess skip flag

MoiJeSors

WRInaute discret
Bonjour à tous,

Je viens d'installer phpBB-SEO v0.7.0 en mode intermédiaire + Zéro Duplicate qui fonctionnent très bien, rien à redire si ce n'est bravo aux développeurs 8)

Mais j'ai un conflit entre le contenu du htaccess du site qui est sous joomla et celui de phpBB-SEO.

En effet, les règles de redirections qui ne devraient s'appliquer qu'au forum, s'appliquent également à des pages du site.
En d'autres termes, les liens de la home du site qui pointent directement vers des articles renvoient vers le forum (url inchangée) avec le message "Le forum que vous avez tenté d’atteindre n’existe pas." :?
Ex :http://www.rescueboule.com/soutenez-rb idem pour les liens blogs de catégories http://www.rescueboule.com/parrainage

Dans la mesure où les règles du forum sont dans le même htaccess que celle du site, j'ai tenté de les isoler avec le flag SKIP, mais cela ne fonctionne pas, à moins que j'ai fais une erreur.
En même temps, je suis habitué à bosser sur des htaccess beaucoup plus simples.

Voici mon htaccess :
Code:
# Lines That should already be in your .htacess
    <Files "config.php">
       Order Allow,Deny
       Deny from All
    </Files>
    <Files "common.php">
       Order Allow,Deny
       Deny from All
    </Files>

    # You may need to un-comment the following lines
    # Options +FollowSymlinks
    # To make sure that rewritten dir or file (/|.html) will not load dir.php in case it exist
    # Options -MultiViews
    # REMEBER YOU ONLY NEED TO STARD MOD REWRITE ONCE
    RewriteEngine On
    # Uncomment the statement below if you want to make use of
    # HTTP authentication and it does not already work.
    # This could be required if you are for example using PHP via Apache CGI.
    # RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    # REWRITE BASE
    RewriteBase /
    # HERE IS A GOOD PLACE TO FORCE CANONICAL DOMAIN
    RewriteCond %{HTTP_HOST} !^www\.rescueboule\.com$ [NC]
    RewriteRule ^(.*)$ http://www.rescueboule.com/$1 [QSA,L,R=301]

    # DO NOT GO FURTHER IF THE REQUESTED FILE / DIR DOES EXISTS
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    #####################################################
    # PHPBB SEO REWRITE RULES ALL MODES
    #####################################################
    # AUTHOR : dcz www.phpbb-seo.com
    # STARTED : 01/2006
    #################################
    # FORUMS PAGES
    ###############
    # FORUM INDEX
    RewriteRule ^forum\.html$ /ForumV2/index.php [QSA,L,NC]
    # FORUM ALL MODES
    RewriteRule ^(forum|[a-z0-9_-]*-f)([0-9]+)/?(page([0-9]+)\.html)?$ /ForumV2/viewforum.php?f=$2&start=$4 [QSA,L,NC]
    # TOPIC WITH VIRTUAL FOLDER ALL MODES
    RewriteRule ^(forum|[a-z0-9_-]*-f)([0-9]+)/(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /ForumV2/viewtopic.php?f=$2&t=$4&start=$6 [QSA,L,NC]
    # TOPIC WITHOUT FORUM ID & DELIM ALL MODES
    RewriteRule ^([a-z0-9_-]*)/?(topic|[a-z0-9_-]*-t)([0-9]+)(-([0-9]+))?\.html$ /ForumV2/viewtopic.php?forum_uri=$1&t=$3&start=$5 [QSA,L,NC]
    # PHPBB FILES ALL MODES
    RewriteRule ^ressources/[a-z0-9_-]+/(thumb/)?([0-9]+)$ /ForumV2/download/file.php?id=$2&t=$1 [QSA,L,NC]
    # PROFILES ALL MODES WITH ID
    RewriteRule ^(membre|[a-z0-9_-]*-u)([0-9]+)\.html$ /ForumV2/memberlist.php?mode=viewprofile&u=$2 [QSA,L,NC]
    # USER MESSAGES ALL MODES WITH ID
    RewriteRule ^(membre|[a-z0-9_-]*-u)([0-9]+)-(topics|posts)(-([0-9]+))?\.html$ /ForumV2/search.php?author_id=$2&sr=$3&start=$5 [QSA,L,NC]
    # GROUPS ALL MODES
    RewriteRule ^(groupe|[a-z0-9_-]*-g)([0-9]+)(-([0-9]+))?\.html$ /ForumV2/memberlist.php?mode=group&g=$2&start=$4 [QSA,L,NC]
    # POST
    RewriteRule ^post([0-9]+)\.html$ /ForumV2/viewtopic.php?p=$1 [QSA,L,NC]
    # ACTIVE TOPICS
    RewriteRule ^sujets-actifs(-([0-9]+))?\.html$ /ForumV2/search.php?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]
    # UNANSWERED TOPICS
    RewriteRule ^sans-reponses(-([0-9]+))?\.html$ /ForumV2/search.php?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]
    # NEW POSTS
    RewriteRule ^nouveaux-messages(-([0-9]+))?\.html$ /ForumV2/search.php?search_id=newposts&start=$2&sr=topics [QSA,L,NC]
    # UNREAD POSTS
    RewriteRule ^non-lu(-([0-9]+))?\.html$ /ForumV2/search.php?search_id=unreadposts&start=$2 [QSA,L,NC]
    # THE TEAM
    RewriteRule ^equipe\.html$ /ForumV2/memberlist.php?mode=leaders [QSA,L,NC]
    # HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES

    # FORUM WITHOUT ID & DELIM ALL MODES
    # THESE THREE LINES MUST BE LOCATED AT THE END OF YOUR HTACCESS TO WORK PROPERLY
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([a-z0-9_-]+)/?(page([0-9]+)\.html)?$ /ForumV2/viewforum.php?forum_uri=$1&start=$3 [QSA,L,NC]
    # FIX RELATIVE PATHS : FILES
    RewriteRule ^ForumV2/.+/(style\.php|ucp\.php|mcp\.php|faq\.php|download/file.php)$ /ForumV2/$1 [QSA,L,NC,R=301]
    # FIX RELATIVE PATHS : IMAGES
    RewriteRule ^ForumV2/.+/(styles/.*|images/.*)/$ /ForumV2/$1 [QSA,L,NC,R=301]
    # END PHPBB PAGES
    #####################################################


    ##
    # @package      Joomla
    # @copyright   Copyright (C) 2005 - 2012 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

    # OVH vers PHP5
    SetEnv PHP_VER 5

    ## Mod_rewrite in use.
    #RewriteEngine On
    #RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
    #RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

    # Register Globals : Off
    SetEnv REGISTER_GLOBALS 0

    # Magic Quotes
    SetEnv MAGIC_QUOTES 0

    ## 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.

Par contre un truc bizarre, dans l'acp du forum dans htaccess --> plus d'option, j'ai bien "Slash droite et gauche RegEx: mais n’apparaît pas "Emplacement du .htaccess" ...?

Si je désactive le SEF de joomla bien sur tout fonctionne correctement mais avec des url du type index.php?option=com_content&view=article&id=7&Itemid=118 :cry:

Voilà, si quelqu'un pouvait m'éclairer parce que là je suis ... largué :? d'avance merci !

Hébergeur OVH
Joomla 2.5.6 / phpBB 3.0.10
Joomla est à la racine www/
Le forum www/dossier
Le htaccess est à la racine www/
Paramètres SEO de Joomla : Réécriture d'URL en clair (SEF) : oui / Réécriture au "vol" des URL : oui
 

Azinya

Nouveau WRInaute
Je te poste mon .htaccess ( à la racine Joomla, phpBB est dans /forum et implémenté via JFusion ) même si je ne suis pas vraiment dans ton cas car je n'ai pas de SEF sur phpBB ( ça viendra sans doute ).

Dans l'esprit, j'ai fait une white-list plutôt que de tout rediriger comme un gros goret vers Joomla, en plus avec un petit hack dans l'index.php de Joomla, ça me permet de standardiser la page d'erreur ( les modules n'ont pas forcément la même page d'erreur ).

Je pense que dans ton cas, réécrire la totalité du .htaccess serait une bonne idée pour vraiment savoir quel url va ou. Et puis, tu va devoir garder les url's vers ton forum en http://*/forum/forum.html je ne pense pas qu'il soit possible de faire autrement :s

Code:
################################## Paramètres PHP ##################################
SetEnv PHP_VER 5_3
SetEnv REGISTER_GLOBALS 0
SetEnv ZEND_OPTIMIZER 1
SetEnv MAGIC_QUOTES 0
SetEnv SESSION_USE_TRANS_SID 0

################################## Paramètres HTTP ##################################
AuthType None
Require all granted
Satisfy Any
IndexIgnore *
DirectoryIndex index.php index.html
Options +FollowSymLinks All -Indexes
FileETag none
ErrorDocument 404 /404.html
ErrorDocument 403 /403.html
ErrorDocument 500 /500.html
########## Compression
# Activer le filtre
SetOutputFilter DEFLATE
# Certains navigateurs ne peuvent pas avoir GZIP (les vieux)
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Certains navigateurs ne peuvent pas avoir GZIP (les vieux)
BrowserMatch ^Mozilla/4\.0678 no-gzip
# On ne veut pas d'IE
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# On ne compresse pas les images, elles le sont déjà.
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
#on gère le cas des proxy
Header append Vary User-Agent env=!dont-vary
	
################################## Rewrites ##################################
RewriteEngine On
RewriteBase /

########## Begin - Rewrite rules to block out some common exploits
# If the request query string contains /proc/self/environ (by SigSiu.net)
RewriteCond %{QUERY_STRING} proc/self/environ [OR]
# Block out any script trying to set a mosConfig value through the URL
# (these attacks wouldn't work w/out Joomla! 1.5's Legacy Mode plugin)
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode or base64_decode data within the URL
RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [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 - File injection protection, by SigSiu.net
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]
RewriteRule .* - [F]
########## End - File injection protection

########## Begin - Basic antispam Filter, by SigSiu.net
RewriteCond %{QUERY_STRING} \b(ambien|blue\spill|cialis|cocaine|ejaculation|erectile)\b [NC,OR]
RewriteCond %{QUERY_STRING} \b(erections|hoodia|huronriveracres|impotence|levitra|libido)\b [NC,OR]
RewriteCond %{QUERY_STRING} \b(lipitor|phentermin|pro[sz]ac|sandyauer|tramadol|troyhamby)\b [NC,OR]
RewriteCond %{QUERY_STRING} \b(ultram|unicauca|valium|viagra|vicodin|xanax|ypxaieo)\b [NC]
RewriteRule .* - [F]
########## End - Basic antispam Filter, by SigSiu.net

########## Begin - Advanced server protection - query strings, referrer and config
## Disallow PHP Easter Eggs (can be used in fingerprinting attacks to determine your PHP version).
RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC]
RewriteRule .* - [F]
## SQLi first line of defense, thanks to Radek Suski (SigSiu.net) May cause problems on legitimate requests
RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR]
RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR]
RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC]
RewriteRule .* - [F]
########## End - Advanced server protection - query strings, referrer and config

########## White LIST for back-ends
### Joomla
RewriteCond %{REQUEST_URI} ^/admin_folder_replace/(|index\.php?)$
RewriteRule .* - [L]
# Allow access to easy_migrate.php si on est sur un serveur local
RewriteCond %{REMOTE_ADDR} ^127.0.0.1$
RewriteRule ^easy_migrate.php$ - [L]
# Back-end protection. This also blocks fingerprinting attacks browsing for XML and INI files
RewriteCond %{REQUEST_URI} ^/administrator/(|index\.php?)$ [OR]
RewriteCond %{REQUEST_URI} ^/administrator/(components|modules|templates|images|plugins)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov|ico)$
RewriteCond %{HTTP_COOKIE} admin_cookie=admin
RewriteRule .* - [L]
RewriteRule ^administrator - [R=404,L]
### PHPBB
RewriteCond %{REQUEST_URI} ^/forum/adm/(|index\.php?)$ [OR]
RewriteCond %{REQUEST_URI} ^/forum/adm/(style|images)/([^/]+/)*([^/.]+\.)+(jp(e?g|2)?|png|gif|bmp|css|js|swf|html?|mp(eg?|[34])|avi|wav|og[gv]|xlsx?|docx?|pptx?|zip|rar|pdf|xps|txt|7z|svg|od[tsp]|flv|mov|ico)$
RewriteCond %{HTTP_COOKIE} admin_cookie=admin
RewriteRule .* - [L]
RewriteRule ^forum/adm - [R=404,L]
########## END FILTERING

########## Begin - White LIST - direct access paths and files
RewriteRule ^(index\.php)?$ - [L]
RewriteRule ^xmlrpc/(index\.php)?$ - [L]
RewriteRule ^includes/js/ - [L]
RewriteRule ^templates/([^/]+/)/css/([^/.]+\.)css$ - [L]
RewriteRule ^templates/g2a/css/g2a.php$ - [L]
RewriteRule ^(modules|forum|images|media|templates|components|plugins)/([^/]+/)*([^/.]+\.)+(js|css|jpg|png|gif|ico)$ - [L]
RewriteRule ^forum/(style|cron)php$ - [L]
########## End - White LIST - direct access paths and files
 
########## Begin - Joomla! core SEF Section
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !config.php
RewriteCond %{REQUEST_FILENAME} !common.php
RewriteRule ^forum/[^/]*?$ index.php [L]
RewriteRule ^[^/]+\.html index.php [L]
RewriteRule ^component/users/(|index\.php)?$ index.php [L]
RewriteRule .* /404.html [R=404,L]
########## End - Joomla! core SEF Section

################################## Caching Control ##################################
########## Begin - Optimal default expiration time
## Note: this might cause problems and you might have to comment it out by
## placing a hash in front of this section's lines
<IfModule mod_expires.c>
	# Enable expiration control
	ExpiresActive On
	# Default expiration: 1 hour after request
	ExpiresDefault "now plus 1 hour"
	# PHP/HTML Exclude
	ExpiresByType text/html "now"
	# CSS and JS expiration: 1 week after request
	ExpiresByType text/css "now plus 1 week"
	ExpiresByType application/javascript "now plus 1 week"
	ExpiresByType application/x-javascript "now plus 1 week"
	# Image files expiration: 1 month after request
	ExpiresByType image/bmp "now plus 1 month"
	ExpiresByType image/gif "now plus 1 month"
	ExpiresByType image/jpeg "now plus 1 month"
	ExpiresByType image/jp2 "now plus 1 month"
	ExpiresByType image/pipeg "now plus 1 month"
	ExpiresByType image/png "now plus 1 month"
	ExpiresByType image/svg+xml "now plus 1 month"
	ExpiresByType image/tiff "now plus 1 month"
	ExpiresByType image/vnd.microsoft.icon "now plus 1 month"
	ExpiresByType image/x-icon "now plus 1 month"
	ExpiresByType image/ico "now plus 1 month"
	ExpiresByType image/icon "now plus 1 month"
	ExpiresByType text/ico "now plus 1 month"
	ExpiresByType application/ico "now plus 1 month"
	ExpiresByType image/vnd.wap.wbmp "now plus 1 month"
	ExpiresByType application/vnd.wap.wbxml "now plus 1 month"
	ExpiresByType application/smil "now plus 1 month"
	# Audio files expiration: 1 month after request
	ExpiresByType audio/basic "now plus 1 month"
	ExpiresByType audio/mid "now plus 1 month"
	ExpiresByType audio/midi "now plus 1 month"
	ExpiresByType audio/mpeg "now plus 1 month"
	ExpiresByType audio/x-aiff "now plus 1 month"
	ExpiresByType audio/x-mpegurl "now plus 1 month"
	ExpiresByType audio/x-pn-realaudio "now plus 1 month"
	ExpiresByType audio/x-wav "now plus 1 month"
	# Movie files expiration: 1 month after request
	ExpiresByType application/x-shockwave-flash "now plus 1 month"
	ExpiresByType x-world/x-vrml "now plus 1 month"
	ExpiresByType video/x-msvideo "now plus 1 month"
	ExpiresByType video/mpeg "now plus 1 month"
	ExpiresByType video/mp4 "now plus 1 month"
	ExpiresByType video/quicktime "now plus 1 month"
	ExpiresByType video/x-la-asf "now plus 1 month"
	ExpiresByType video/x-ms-asf "now plus 1 month"
</IfModule>
########## End - Optimal expiration time

Et mon petit hack Joomla :

Code:
// Route the application.
if ( isset($_SERVER['REDIRECT_URL']) && $_SERVER['REDIRECT_URL'] == '/404.html' ) Jerror::raiseError(404, "L'article n'existe pas.");
$app->route();

La ligne du centre :)

Bref, organise ton .htaccess, et ça viendra tout seul :p Je suis aussi ouvert aux remarques.
 

Discussions similaires

Haut