云优CMS官方论坛_开源城市分站管理系统
搜索
 找回密码
 立即注册
查看: 43|回复: 1

apache伪静态怎么把url链接修改成扁平化的url?

[复制链接]

3

主题

12

帖子

12

积分

新手上路

Rank: 1

积分
12
发表于 3 天前 | 显示全部楼层 |阅读模式
默认的apache伪静态,生成的链接地址是xxx.com/lanmu1/111.html 怎么设置可以改成直接让文章生成在根目录,改成xxx.com/111.html 这样扁平化的url结构更加有利于在百度的展现

  1. <IfModule mod_rewrite.c>
  2.     Options +FollowSymlinks -Multiviews
  3.     ErrorDocument 404 /404.htm
  4.     RewriteEngine On

  5.     RewriteCond %{REQUEST_FILENAME} !-d
  6.     RewriteCond %{REQUEST_FILENAME} !-f
  7.     RewriteRule ^(.*)\.(asp|aspx|asa|asax|dll|jsp|cgi|fcgi|pl)(.*)$ /404.htm



  8.     RewriteRule ^phpMyAdmin/(.*)$ phpMyAdmin/$1 [QSA,PT,L]
  9.     RewriteRule ^404.htm$ index.php?s=index/index/empty404 [QSA,PT,L]
  10.     RewriteRule ^admin/(.*).html$ index.php?s=admin/$1 [QSA,PT,L]
  11.     RewriteRule ^admin/(.*)$ index.php?s=admin/$1 [QSA,PT,L]

  12.     RewriteRule ^config/(.*)$ /404.htm [QSA,PT,L]
  13.     RewriteRule ^statics/ueditor/dialogs/(.*)/(.*).html$ statics/ueditor/dialogs/$1/$2.html [QSA,PT,L]
  14.    
  15.     RewriteRule ^m/$ index.php?s=wap/index/index [QSA,PT,L]
  16.     RewriteRule ^m/myform/$ index.php?s=wap/myform/index [QSA,PT,L]
  17.     RewriteRule ^m/captcha/(\d*)$ index.php?s=wap/myform/captcha&id=$1 [QSA,PT,L]
  18.     RewriteRule ^m/search/$ index.php?s=wap/search/index [QSA,PT,L]
  19.     RewriteRule ^m/(.*)_search/$ index.php?s=wap/search/index&area=$1 [QSA,PT,L]
  20.     RewriteRule ^m/tag/([\s\S]*)$ index.php?s=wap/tag/index&title=$1 [QSA,PT,L]
  21.     RewriteRule ^m/(.*)_tag/([\s\S]*)$ index.php?s=wap/tag/index&title=$2&area=$1 [QSA,PT,L]

  22.     RewriteRule ^m/(.*)/(.*)_(.*)/(.*)_(.*).html$ index.php?s=wap/show/index&etitle=$4&ctitle=$1/$3&area=$2&cw=$5 [QSA,PT,L]
  23.     RewriteRule ^m/(.*)_(.*)/(.*)_(.*).html$ index.php?s=wap/show/index&etitle=$3&ctitle=$2&area=$1&cw=$4 [QSA,PT,L]
  24.     RewriteRule ^m/(.*)/(.*)_(.*)/(.*).html$ index.php?s=wap/show/index&etitle=$4&ctitle=$1/$3&area=$2 [QSA,PT,L]
  25.     RewriteRule ^m/(.*)_(.*)/(.*).html$ index.php?s=wap/show/index&etitle=$3&ctitle=$2&area=$1 [QSA,PT,L]
  26.     RewriteRule ^m/(.*)/(.*)_(.*).html$ index.php?s=wap/show/index&etitle=$2&ctitle=$1&cw=$3 [QSA,PT,L]
  27.     RewriteRule ^m/(.*)/(.*).html$ index.php?s=wap/show/index&etitle=$2&ctitle=$1 [QSA,PT,L]

  28.     RewriteRule ^m/(.*)/(.*)_(.*)/$ index.php?s=wap/category/index&ctitle=$1/$3&area=$2 [QSA,PT,L]
  29.     RewriteRule ^m/(.*)_(.*)/$ index.php?s=wap/category/index&ctitle=$2&area=$1 [QSA,PT,L]
  30.     RewriteRule ^m/(.*)/(.*)_(.*)/page/(\d*)$ index.php?s=wap/category/index&ctitle=$1/$3&area=$2&page=$4 [QSA,PT,L]
  31.     RewriteRule ^m/(.*)_(.*)/page/(\d*)$ index.php?s=wap/category/index&ctitle=$2&area=$1&page=$3 [QSA,PT,L]
  32.     RewriteRule ^m/(.*)/$ index.php?s=wap/category/index&ctitle=$1 [QSA,PT,L]
  33.     RewriteRule ^m/(.*)/page/(\d*)$ index.php?s=wap/category/index&ctitle=$1&page=$2 [QSA,PT,L]
  34.     RewriteRule ^m/(.*).html$ index.php?s=wap/index/index&area=$1 [QSA,PT,L]

  35.     RewriteRule ^index(.*)/$ index.php?s=index/index/index/$1 [QSA,PT,L]
  36.     RewriteRule ^myform/$ index.php?s=index/myform/index [QSA,PT,L]
  37.     RewriteRule ^(.*)_myform/$ index.php?s=index/myform/index&area=$1 [QSA,PT,L]
  38.     RewriteRule ^captcha/(\d*)$ index.php?s=index/myform/captcha&id=$1 [QSA,PT,L]
  39.     RewriteRule ^(.*)_captcha/(\d*)$ index.php?s=index/myform/captcha&area=$1&id=$2 [QSA,PT,L]

  40.     RewriteRule ^search/$ index.php?s=index/search/index [QSA,PT,L]

  41.     RewriteRule ^search/page/(\d*)$ index.php?s=index/search/index&page=$1 [QSA,PT,L]
  42.     RewriteRule ^search/key/(.*)/page/(\d*)$ index.php?s=index/search/index&key=$1&page=$2 [QSA,PT,L]

  43.     RewriteRule ^(.*)_search/$ index.php?s=index/search/index&area=$1 [QSA,PT,L]
  44.     RewriteRule ^(.*)_search/page/(\d*)$ index.php?s=index/search/index&area=$1&page=$2 [QSA,PT,L]
  45.     RewriteRule ^(.*)_search/key/(.*)/page/(\d*)$ index.php?s=index/search/index&area=$1&key=$2&page=$3 [QSA,PT,L]

  46.     RewriteRule ^(.*)_tag/([\s\S]*)/page/(\d*)$ index.php?s=index/tag/index&title=$2&area=$1&page=$3 [QSA,PT,L]
  47.     RewriteRule ^(.*)_tag/([\s\S]*)$ index.php?s=index/tag/index&title=$2&area=$1 [QSA,PT,L]
  48.     RewriteRule ^tag/([\s\S]*)/page/(\d*)$ index.php?s=index/tag/index&title=$1&page=$2 [QSA,PT,L]
  49.     RewriteRule ^tag/([\s\S]*)$ index.php?s=index/tag/index&title=$1 [QSA,PT,L]
  50.    
  51.     RewriteRule ^(.*)/(.*)_(.*)/(.*)_(.*).html$ index.php?s=index/show/index&etitle=$4&ctitle=$1/$3&area=$2&cw=$5 [QSA,PT,L]
  52.     RewriteRule ^(.*)_(.*)/(.*)_(.*).html$ index.php?s=index/show/index&etitle=$3&ctitle=$2&area=$1&cw=$4 [QSA,PT,L]
  53.     RewriteRule ^(.*)/(.*)_(.*)/(.*).html$ index.php?s=index/show/index&etitle=$4&ctitle=$1/$3&area=$2 [QSA,PT,L]
  54.     RewriteRule ^(.*)_(.*)/(.*).html$ index.php?s=index/show/index&etitle=$3&ctitle=$2&area=$1 [QSA,PT,L]
  55.     RewriteRule ^(.*)/(.*)_(.*).html$ index.php?s=index/show/index&etitle=$2&ctitle=$1&cw=$3 [QSA,PT,L]
  56.     RewriteRule ^(.*)/(.*).html$ index.php?s=index/show/index&etitle=$2&ctitle=$1 [QSA,PT,L]

  57.     RewriteRule ^(.*)/(.*)_(.*)/$ index.php?s=index/category/index&ctitle=$1/$3&area=$2 [QSA,PT,L]
  58.     RewriteRule ^(.*)_(.*)/$ index.php?s=index/category/index&ctitle=$2&area=$1 [QSA,PT,L]
  59.     RewriteRule ^(.*)/(.*)_(.*)/page/(\d*)$ index.php?s=index/category/index&ctitle=$1/$3&area=$2&page=$4 [QSA,PT,L]
  60.     RewriteRule ^(.*)_(.*)/page/(\d*)$ index.php?s=index/category/index&ctitle=$2&area=$1&page=$3 [QSA,PT,L]
  61.     RewriteRule ^(.*)/$ index.php?s=index/category/index&ctitle=$1 [QSA,PT,L]
  62.     RewriteRule ^(.*)/page/(\d*)$ index.php?s=index/category/index&ctitle=$1&page=$2 [QSA,PT,L]
  63.     RewriteRule ^index.html$ index.php?s=index/index/index [QSA,PT,L]
  64.     RewriteRule ^(.*).html$ index.php?s=index/index/index&area=$1 [QSA,PT,L]
  65. </IfModule>
复制代码


回复

使用道具 举报

3

主题

12

帖子

12

积分

新手上路

Rank: 1

积分
12
 楼主| 发表于 3 天前 | 显示全部楼层
我把.htaccess伪静态里面/改成_后,可以实现扁平化的链接,但是栏目列表 里面的路由链接还需要改,否则页面都变成404了,可以告知需要改哪个页面的路由链接吗?
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|小黑屋|云优CMS官方论坛

GMT+8, 2020-9-18 21:04 , Processed in 0.039464 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表