Petit probleme d'URL rewriting

Nouveau WRInaute
Bonsoir a tous !
Je me joins a la communaute wrinaute en vous exposant mon probleme ; voici mon code :

RewriteCond %{REQUEST_URI} !^index\.php\?menu=.*$ [OR]
RewriteCond %{REQUEST_URI} !^index\.php$ [OR]
RewriteCond %{REQUEST_URI} !^.*\.htm$
RewriteRule .* - [F]

Par ce code, je voudrais n'autoriser l'ecriture de l'URL que sous 3 formes :
index.php?menu=xxxxxx
index.php
ou xxxx.htm

Si ces 3 formes d'ecriture ne sont pas respectees, je veux lui refuser l'acces au site. Seulement mon code doit etre faux car pour n'importe quelle ecriture, l'acces au site m'est interdite !

Merci d'avance pour votre aide :)

PS : en surfant un peu sur le forum je n'ai pas trouve de code permettant de resoudr emon probleme alors voila pourquoi je poste ... :/
 
Nouveau WRInaute
ben j'ai essaye les [AND] mais je crois que ca marche pas... ca me fait une grosse erreur comme pour dire que le htaccess est invalide :S
 
WRInaute occasionnel
Le flag [AND] n'existe pas, il est sous entendu lors ce que tu met plusieur RewriteCond à la suite.
Code:
RewriteCond %{REQUEST_URI} !^index\.php\?menu=.*$
RewriteCond %{REQUEST_URI} !^index\.php$
RewriteCond %{REQUEST_URI} !^.*\.htm$
RewriteRule .* - [F]
 
Nouveau WRInaute
merci pour l'aide magic mais avec ce code :

RewriteCond %{REQUEST_URI} !^index\.php\?menu=.*$
RewriteCond %{REQUEST_URI} !^index\.php$
RewriteCond %{REQUEST_URI} !^.*\.htm$
RewriteRule .* - [F]

la situation ne change toujours pas et j'ai toujours cette erreur :

Forbidden
You don't have permission to access index.php on this server.

je vous montre une partie de mon htaccess ca peut peut-etre vous aider :

Code:
#Activation de l'URL rewriting
Options +FollowSymlinks
RewriteEngine on


#anti aspirateur de site
RewriteCond %{HTTP_USER_AGENT} ^-?$ [OR]
RewriteCond %{HTTP_USER_AGENT} Advanced\ Email\ Extractor [OR]
RewriteCond %{HTTP_USER_AGENT} almaden [NC,OR]
RewriteCond %{HTTP_USER_AGENT} @nonymouse [OR]
RewriteCond %{HTTP_USER_AGENT} Art-Online [OR]
RewriteCond %{HTTP_USER_AGENT} CherryPicker [OR]
RewriteCond %{HTTP_USER_AGENT} Crescent\ Internet\ ToolPack [OR]
RewriteCond %{HTTP_USER_AGENT} DirectUpdate [OR]
RewriteCond %{HTTP_USER_AGENT} Download\ Accelerator [OR]
RewriteCond %{HTTP_USER_AGENT} eCatch [OR]
RewriteCond %{HTTP_USER_AGENT} echo\ extense [OR]
RewriteCond %{HTTP_USER_AGENT} EmailCollector [OR]
RewriteCond %{HTTP_USER_AGENT} EmailWolf [OR]
RewriteCond %{HTTP_USER_AGENT} ExtractorPro [OR]
RewriteCond %{HTTP_USER_AGENT} Fetch\ API\ Request [OR]
RewriteCond %{HTTP_USER_AGENT} flashget [NC,OR]
RewriteCond %{HTTP_USER_AGENT} frontpage [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Go!Zilla [OR]
RewriteCond %{HTTP_USER_AGENT} HTTP\ agent [OR]
RewriteCond %{HTTP_USER_AGENT} HTTPConnect [OR]
RewriteCond %{HTTP_USER_AGENT} HTTrack [OR]
RewriteCond %{HTTP_USER_AGENT} Indy\ Library [OR]
RewriteCond %{HTTP_USER_AGENT} IPiumBot\ laurion(dot)com [OR]
RewriteCond %{HTTP_USER_AGENT} Kapere [OR]
RewriteCond %{HTTP_USER_AGENT} libwww-perl [OR]
RewriteCond %{HTTP_USER_AGENT} Microsoft\ URL\ Control [OR]
RewriteCond %{HTTP_USER_AGENT} minibot\(NaverRobot\) [OR]
RewriteCond %{HTTP_USER_AGENT} NICErsPRO [OR]
RewriteCond %{HTTP_USER_AGENT} NPBot [OR]
RewriteCond %{HTTP_USER_AGENT} Offline\ Explorer [OR]
RewriteCond %{HTTP_USER_AGENT} Offline\ Navigator [OR]
RewriteCond %{HTTP_USER_AGENT} Program\ Shareware [OR]
RewriteCond %{HTTP_USER_AGENT} QuepasaCreep [OR]
RewriteCond %{HTTP_USER_AGENT} SiteMapper [OR]
RewriteCond %{HTTP_USER_AGENT} Star\ Downloader [OR]
RewriteCond %{HTTP_USER_AGENT} SurveyBot [OR]
RewriteCond %{HTTP_USER_AGENT} Teleport\ Pro [OR]
RewriteCond %{HTTP_USER_AGENT} Telesoft [OR]
RewriteCond %{HTTP_USER_AGENT} TurnitinBot [OR]
RewriteCond %{HTTP_USER_AGENT} webbandit [NC,OR]
RewriteCond %{HTTP_USER_AGENT} WebCapture [OR]
RewriteCond %{HTTP_USER_AGENT} webcollage [OR]
RewriteCond %{HTTP_USER_AGENT} WebCopier [OR]
RewriteCond %{HTTP_USER_AGENT} WebDAV [OR]
RewriteCond %{HTTP_USER_AGENT} WebEmailExtractor [OR]
RewriteCond %{HTTP_USER_AGENT} WebReaper [OR]
RewriteCond %{HTTP_USER_AGENT} WEBsaver [OR]
RewriteCond %{HTTP_USER_AGENT} WebStripper [OR]
RewriteCond %{HTTP_USER_AGENT} WebZIP [OR]
RewriteCond %{HTTP_USER_AGENT} Wget [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Wysigot [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Naja [OR]
RewriteCond %{HTTP_USER_AGENT} webdownloader [OR]
RewriteCond %{HTTP_USER_AGENT} Zeus.*Webster [OR]
RewriteCond %{HTTP_USER_AGENT} Zeus [OR]
RewriteCond %{HTTP_REFERER} ^XXX
RewriteRule ^.*$ https://www.google.fr [R,L]

#anti hacking
RewriteCond %{REQUEST_URI} !^index\.php\?menu=.*$
RewriteCond %{REQUEST_URI} !^index\.php$
RewriteCond %{REQUEST_URI} !^.*\.htm$
RewriteRule .* - [F]

#liens fixes :
RewriteRule ^index\.htm$  index.php [L]
RewriteRule ^contacts\.htm$ index.php?menu=contacts [L]
RewriteRule ^mot-de-passe-oublie\.htm$ index.php?menu=mdp_oublier [L]
RewriteRule ^inscription\.htm$ index.php?menu=inscription [L]
RewriteRule ^modifier-mon-avatar\.htm$ index.php?menu=modification_avatar [L]
RewriteRule ^chat\.htm$ index.php?menu=chat [L]
RewriteRule ^agenda\.htm$ index.php?menu=agenda [L]
RewriteRule ^ce-soir\.htm$ index.php?menu=cesoir [L]
RewriteRule ^accueil\.htm$ index.php?menu=pac [L]
RewriteRule ^photos\.htm$ index.php?menu=espace_membre [L]
RewriteRule ^espace-membre\.htm$ index.php?menu=espace_membre [L]
RewriteRule ^mon-compte\.htm$ index.php?menu=mon_compte [L]
RewriteRule ^inscription-professionnel\.htm$ index.php?menu=inscription_pro [L]
RewriteRule ^ajouter-un-evenement\.htm$ index.php?menu=ajouterevenement [L]
RewriteRule ^modifier-un-evenement\.htm$ index.php?menu=modification_evenement [L]
RewriteRule ^modifier-mon-profil\.htm$ index.php?menu=modification [L]
RewriteRule ^modifier-ma-photo\.htm$ index.php?menu=modification_avatar [L]
RewriteRule ^modifier-mon-mot-de-passe\.htm$ index.php?menu=modification_mdp [L]
RewriteRule ^modifier-mon-etabissement\.htm$ index.php?menu=modification_pro [L]
RewriteRule ^modifier-un-evenement\.htm$ index.php?menu=modification_evenement [L]
RewriteRule ^gestion-du-niveau-des-utilisateurs\.htm$ index.php?menu=niveaux [L]
RewriteRule ^gestion-des-membres\.htm$ index.php?menu=membres [L]
RewriteRule ^gestion-de-la-banlist\.htm$ index.php?menu=banlist [L]
RewriteRule ^gestion-des-types-etablissements\.htm$ index.php?menu=typeetablissement [L]
RewriteRule ^gestion-de-tous-les-etablissements\.htm$ index.php?menu=etablissements [L]
RewriteRule ^gestion-des-news\.htm$ index.php?menu=news [L]
RewriteRule ^modifier-le-logo\.htm$ index.php?menu=modification_logo [L]

#liens variants :
RewriteRule ^([a-z]+)-ville\.htm$ index.php?menu=afficher_eta&type=$1 [L]
RewriteRule ^([a-z]+)-([0-9]+)-ville\.htm$ index.php?menu=afficher_eta&type=$1&id=$2 [L]
 
Nouveau WRInaute
Si je commente les 3 lignes de la partie #anti hacking , bah le site marche bien mais plus de protection de l'ecriture de l'URl, je comprend pss ce qui cloche, pouratnt l'erreur doit etre devant mes yeux !
 
WRInaute passionné
essaie
Code:
RewriteCond %{REQUEST_URI} !^/index\.php\?menu=.*$
RewriteCond %{REQUEST_URI} !^/index\.php$
RewriteCond %{REQUEST_URI} !^.*\.htm$
RewriteRule .* - [F]
 
Nouveau WRInaute
Non ca marche toujours pas... :/

je desespere ... quand j'aurais la solution devant les yeux je vais me defoncer contre la poutre de mon appart !
 
WRInaute passionné
j'ai essayé en local, et ça marche bien, sauf que le RewriteCond n'a que faire du QUERY_STRING.
essaie de virer tes autres lignes, pour voir si y'a pas un pb de compatibilité
 
Nouveau WRInaute
Si je vire la section #anti hacking le site marche mais bon je veux securiser, et j'ai vu sur webrankinfo qu'il fallait utiliser RewriteCond pour arriver a mes fins.

si je commente comme ceci :

#anti hacking
RewriteCond %{REQUEST_URI} !^/index\.php\?menu=.*$
#RewriteCond %{REQUEST_URI} !^/index\.php$
#RewriteCond %{REQUEST_URI} !^.*\.htm$
RewriteRule .* - [F]

et je met dans l'URL :
http://www...............mon site.................................../index.php?menu=contacts

le serveur me repond :

You don't have permission to access /index.php on this server.

Je fais mes tests directement en ligne sur un serveur sous OVH. L'URL rewriting je le repete marche bien juste la section #anti hacking de mon htaccees dont j'ai poste le code plus haut ne marche pas. On m'a bien aide deja mais ca ne marche pas :S
 
Nouveau WRInaute
Et si je vire tout sauf la section #anti hacking , lorsque je demande cette url :

http://www...............mon site.................................../index.php?menu=contacts

le serveur me repond toujours :

You don't have permission to access /index.php on this server.
 
Nouveau WRInaute
jeroen merci pour ta perseverance a m'aider :)

mais regarde 2 post plus haut j'ai aussi essaye et reessaye ca marche toujours pas :/
 

➡️ Offre MyRankingMetrics ⬅️

pré-audit SEO gratuit avec RM Tech (+ avis d'expert)
coaching offert aux clients (avec Olivier Duffez ou Fabien Faceries)

Voir les détails ici

coaching SEO
Discussions similaires
Haut