Sur un serveur LAMP, je veux l'URL Sur un serveur LAMP, je souhaite que l'URL http://example.com/index.php soit réécrite sur http://example.com. Comment je fais ça?
http://example.com/index.phpêtre réécrites simplement
http://example.com
Mon fichier .htaccess actuel comme suit ...
IndexIgnore *
ErrorDocument 400 /index.php?module=error&action=error
ErrorDocument 401 /index.php?module=error&action=error
ErrorDocument 403 /index.php?module=error&action=error
ErrorDocument 404 /index.php?module=error&action=error
ErrorDocument 500 /index.php?module=error&action=error
RedirectMatch 301 ^/media/$/
RedirectMatch 301 ^/media/documents/$/
RedirectMatch 301 ^/media/graphics/$/
RedirectMatch 301 ^/media/photos/$/
RedirectMatch 301 ^/library/$/
RedirectMatch 301 ^/library/css/$/
RedirectMatch 301 ^/library/ht/$/
RedirectMatch 301 ^/library/js/$/
RedirectMatch 301 ^/library/php/$/
RewriteEngine on
RewriteBase/
RewriteRule ^home$ /index.php?module=home&action=frontpage
RewriteRule ^home/$ /index.php?module=home&action=frontpage
RewriteRule ^home/([^/\.]+)$ /index.php?module=home&action=$1
RewriteRule ^home/([^/\.]+)/$ /index.php?module=home&action=$1
RewriteRule ^cv$ /index.php?module=home&action=cv
RewriteRule ^cv/$ /index.php?module=home&action=cv
RewriteRule ^release$ /index.php?module=release&action=release
RewriteRule ^release/$ /index.php?module=release&action=release
RewriteRule ^photos$ /index.php?module=gallery&action=album&album=general
RewriteRule ^photos/$ /index.php?module=gallery&action=album&album=general
RewriteRule ^gallery$ /index.php?module=gallery&action=album&album=general
RewriteRule ^gallery/$ /index.php?module=gallery&action=album&album=general
RewriteRule ^gallery/([^/\.]+)$ /index.php?module=gallery&action=album&album=$1
RewriteRule ^gallery/([^/\.]+)/$ /index.php?module=gallery&action=album&album=$1
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)$ /index.php?module=gallery&action=album&album=$1$&page=$2
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/$ /index.php?module=gallery&action=album&album=$1$&page=$2
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/([^/\.]+)$ /index.php?module=gallery&action=item&album=$1$&page=$2&item=$3
RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/([^/\.]+)/$ /index.php?module=gallery&action=item&album=$1$&page=$2&page=$3
RewriteRule ^handouts$ /index.php?module=home&action=handouts
RewriteRule ^handouts/$ /index.php?module=home&action=handouts
RewriteRule ^links$ /index.php?module=home&action=links
RewriteRule ^links/$ /index.php?module=home&action=links
RewriteRule ^contact$ /index.php?module=home&action=contact
RewriteRule ^contact/$ /index.php?module=home&action=contact
RewriteRule ^login$ /index.php?module=authentication&action=login
RewriteRule ^login/$ /index.php?module=authentication&action=login
RewriteRule ^logout$ /index.php?module=authentication&action=logout
RewriteRule ^logout/$ /index.php?module=authentication&action=logout
RewriteRule ^copyright$ /index.php?module=home&action=copyright
RewriteRule ^copyright/$ /index.php?module=home&action=copyright
RewriteRule ^error$ /index.php?module=error&action=error
RewriteRule ^error/$ /index.php?module=error&action=error
Comment dois-je modifier mon fichier .htaccess pour accomplir cette réécriture de base? De plus, tout autre commentaire concernant mon code .htaccess serait grandement apprécié.
Merci d'avance!
Je n'ai jamais vu un tel fichier .htaccess broussailleux dans ma vie. Êtes-vous vraiment écrit tout ce gâchis et ne savez pas comment ajouter cette règle de réécriture simple? –
Je l'ai écrit, lol, mais j'ai des problèmes avec une erreur de redirection. Peut-être que c'est trop touffu! lol Des recommandations sur comment rendre le code plus efficace? – Drew2345