Sujet fermé
Note de ce sujet :
  • Moyenne : 0 (0 vote(s))
  • 1
  • 2
  • 3
  • 4
  • 5

[RESOLU] Rewrite URL = page 404
#7

non britanicus, tu as certes lu la bonne documentation, mais tu l'as mal lu.

http://wiki.cmsmadesimple.org/index.php/...ty_URL.27s

ce qui t'interesse directement (et notamment avoir des pages en .htm effectivement)

Citation : .htm page extension

This configuration will use a .htm extension for the pages. Pages will have URLs like www.example.com/page1.htm, and if use_hierarchy is turned on, nested pages (subpages) will have URLs like www.example.com/page1/page11.htm)

Options +FollowSymLinks
RewriteEngine on
RewriteBase /

# 301 Redirect all requests that don't contain a dot or trailing slash to
# include a trailing slash
# RewriteCond %{REQUEST_URI} !/$
# RewriteCond %{REQUEST_URI} !\.
# RewriteRule ^(.*) %{REQUEST_URI}/ [R=301,L]

# Rewrites urls in the form of /parent/child/
# but only rewrites if the requested URL is not a file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+).htm$ index.php?page=$1 [QSA]

Save the file and upload it to your site's root as '.htaccess' (no file extension!).

Viens ensuite la seconde partie : là où tu confonds

Citation : Note: if you are using the News module and want publish a rss feed than you will have the following problem if you use an extension. Normally your feed is available under http://host/News/rss but with mod_rewrite turned on the server will not find anything because http://host/News/rss is not rewritten to http://host/index.php?page=News/rss. You can solve the problem in two ways.

1. add an extra rule just before the first RewriteRule:

RewriteRule ^News/rss(.+)$ index.php?page=News/rss$1 [ S=1]

This rewrites just the rss feeds to the thing you need. You can add extensions like .xml or .rss
2. use a more general rewrite rule:

RewriteRule ^(.+)(.html)?$ index.php?page=$1 [QSA]

Now all pages with or without extension .htm will work.

Une traduction approximative qui comporte une petite erreur de typo et qui te dira que cette seconde partie est utile pour catcher les pages avec ou sans .html :

Now all pages with or without extension .htm will work.

C'est donc une manière détournée de faire fonctionner

mapage.html et
mapage

ce n'est pas ce que tu souhaites faire, je te déconseille pour l'instant de jouer avec ceci, contente toi de la première partie
Sujet fermé


Messages dans ce sujet

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)