用户手册(seo + 自动生成)

发布于 2025-01-02 20:18:49 字数 461 浏览 1 评论 0原文

我有一个网站,人们可以在线获取该手册。我有一个新版本的手册,其中所有内容都是使用 php 和 mysql 动态生成的。所以不再生成 html。

我现在有法语和英语的手册。我了解到,出于搜索引擎的目的,如果我有与 gogole 和 yahoo 等友好的 url 会很好...

现在这是我的问题:

我想显示这样的 url:

  • /manual/ 将转到主手册用户选择语言的页面
  • /manual/fr/ 这将显示所有可用章节的列表
  • /manual/fr/1.0 这将显示第 1 章

我知道我需要在哪里使用类似的内容:

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

我可以使用1 规则?或者我需要多个?

非常感谢

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:

  • /manual/ that will go to the main manual page where the user choose a lang
  • /manual/fr/ this will display the list of all available chapters
  • /manual/fr/1.0 this will display the chapter 1

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

方圜几里 2025-01-09 20:18:49

这是您必须做的:

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]

第一个将加载用户选择语言的页面。在 PHP 中,您可以检查 $_GET['action'] 以便加载“选择语言”页面。第二个想法与第一个相同,但章节列表不同。现在是第三个,您可以使用 /manual/fr/1.0/manual/fr/1.0/chapter-title。如果您添加标题,这将更适合 SEO。

每个 RewriteRule 末尾的 [] 是标志,在此处了解更多信息:http://httpd.apache.org/docs/2.3/rewrite/flags.html

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文