使用的.htaccess追加html的URL路径的背后(using .htaccess to append .html behind url path)

   IT问题网   2019-08-16 00:00:00

问 题

人们进入我的网站是这样的:

sitename.com/brands/branda

但是,这将导致404错误,因为我确实需要他们来这个网址

sitename.com/brands/branda.html

当有人进入需要时自动如何可以追加.html扩展 sitename.com/brands / * 与不使用.html扩展名的的.htaccess 文件。

解决方案

你为什么不试试这个。

rewriteengine叙述上
重写规则^ /品牌/(.*)$ /brands/$1.html [l]
 

标签:使用追加路径背后暗地里



分享:

  • 微信
  • QQ好友
  • QQ空间
  • 新浪微博


热门推荐

的.htaccess迫使对SSL错误页面(.htaccess forcing error pages on SSL)

problem i have the following piece of code in ...

可变301重定向URL(301 redirect URL with variable)

problem i want to use htaccess to 301 redirect (not rewri ...

htaccess的重定向example.com/index.php到example.com/home~~V(htaccess redirect example.com/index.php to example.com/home)

problem thanks in advance, i am trying to redirect anyone ...

htaccess的重写规则问题(.htaccess Rewrite Rule Problems)

problem can anyone help me with htaccess rewr ...

htaccess的子域名与所有的变量文件参数(.htaccess sub domain as file parameter with all the variables)

problem i want to make this url redirect usin ...

字preSS定制的mod_rewrite - totalnoob?(Wordpress custom mod_rewrite - totalnoob)

problem i'm trying to make a custom mod_rewrite rule for ...

我怎样才能让我的网址,从这个例子中友好吗?(How can I make my urls friendly from this example)

problem my site currently displays like this (when clicki ...

htaccess的问题强制SSL(.htaccess issue to force SSL)

problem i activated ssl on one of my sites (based on word ...

IfModule不会出现是工作?(IfModule doesn't appear to be working)

problem if i use this: lt;ifmodule mod_rewrite.cgt; rewr ...

我怎样才能利用外界信息的URL重写?(How can I get use outside information in url rewrites)

problem hopefully some of you .htaccess gurus can help me ...

基于URL到一个新的页面的RewriteCond重写规则进行的.htaccess,定期EX pression(RewriteCond RewriteRule for .htaccess based on URL to a new page, regular expression)

problem i have an interesting rewriterule and i am not su ...

的.htaccess,mod_rewrite的,正则表达式用目录和文件类型(.htaccess, mod_rewrite, regex with directory and filetype)

problem i want to do a rewrite with the following conditi ...

.htaccess的语言重定向310错误(Htaccess language Redirect 310 error)

problem i have a two language site swedish sidewww.site ...

重定向一切的index.php(Redirection everything to index.php)

problem i wan't to redirect everything to index.php exepe ...

生成SE友好的URL的.htaccess国防部重写(Generating SE friendly URL .htaccess mod rewrite)

problem i've a url which get file name through get method ...

htaccess的子域名重定向(htaccess subdomain redirect)

problem i've searched around and tried a few ...

UrlRewrite 3 GET请求(UrlRewrite with 3 get request)

problem i'm working on a project and stuck on urlrewrite. ...

mod_rewrite的:恶意重定向(Mod_ReWrite: Unwanted redirect)

problem possible duplicate: .htaccess, clean ...

限制用户子目录(limiting users to subdirectories)

problem i have a subdirectory of users that i want to lim ...

重定向子文件夹的.htaccess(Redirection Subfolder Htaccess)

problem i want a redirect using htaccess i have a post na ...