User Manual (seo + auto generate)

I have a website that allows people to get leadership online. I have a new version of the manual where everything is generated dynamically using php and mysql. therefore no more html is generated.

I have a manual in French and English. I will find out that it will be good for search engines if I have a URL that is friendly with gogol and Yahoo, etc.

now here is my problem:

I want to show the url like this:

  • / manual /, which will go to the main page of the manual, where the user selects lang
  • / manual / fr / displays a list of all available partitions
  • /manual/fr/1.0 chapter 1 will be displayed

I got an idea when I need to use something like:

rewriterule /manual/(.*)/(.*)/(.*)/ index.php?lang=$1& ... 

Can I do this using 1 rule? or do i need multiples?

Many thanks

+7
source share
1 answer

Here is what you need 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 will load the page where the user selects lang. In your PHP, you can check $_GET['action'] so that you can load the "select lang" page. The second is the same idea as the first, but for a list of chapters. Now you can use /manual/fr/1.0 or /manual/fr/1.0/chapter-title . This will work better for SEO if you add a headline.

[] at the end of each RewriteRule is a flag, learn more here: http://httpd.apache.org/docs/2.3/rewrite/flags.html

+11
source

All Articles