i have a website that allows people to get the manual online. i have a new version of the manual where everything is generated dynamically using php and mysql. so no more html generated.
i have the manual in french and english now. i learn that for search engine purposes it will be good if i have url that are friendly with gogole and yahoo etc...
now here's my problem:
i want to show the url like this:
i got the idea where i need to use something like :
rewriterule /manual/(.*)/(.*)/(.*)/ index.php?lang=$1& ...
can i do this using 1 rule? or i need multiples?
thanks so much
Here's what you have to do:
RewriteEngine On
RewriteRule ^manual/?$ index.php?action=selectLang [L,NC,QSA]
RewriteRule ^manual/(fr|en)/?$ index.php?action=listChapter&lang=$1 [L,NC,QSA]
RewriteRule ^manual/(fr|en)/([0-9\.]+)(/[^/]+)?/?$ index.php?action=listChapter&lang=$1&chapter=$2 [L,NC,QSA]
The first one will load the page where the user choose a lang. In your PHP you can check the $_GET['action']
so you can load the "select the lang" page. The second same idea as the first one but for the chapter list. Now the third one, you can either use /manual/fr/1.0
or /manual/fr/1.0/chapter-title
. This will work better for SEO if you add the title.
[]
at the end of each RewriteRule
are the flag, learn more here: http://httpd.apache.org/docs/2.3/rewrite/flags.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With