bos*_*ami 2 php .htaccess hyperlink
可能重复:
.htaccess重写以将根URL重定向到子目录
我需要更改我网站中的所有链接(2455).
当访问者来自Google(使用旧链接)时,会出现问题 404 page not found
我想将旧链接重定向到新版本的页面.例如:
旧链接:
http://example.com/hotel/13234
http://example.com/hotel/132
http://example.com/hotel/323
http://example.com/page/about_us
http://example.com/page/contact
Run Code Online (Sandbox Code Playgroud)
新链接:(在域名后添加"博客")
http://example.com/blog/hotel/13234
http://example.com/blog/hotel/132
http://example.com/blog/page/about_us
http://example.com/blog/hotel/323
...
...
...
Run Code Online (Sandbox Code Playgroud)
做这个的最好方式是什么?
使用mod_rewrite:
RewriteEngine On
RewriteRule $ /blog [L,R=301]
Run Code Online (Sandbox Code Playgroud)
这将为所有链接添加前缀blog并永久重定向它们.
| 归档时间: |
|
| 查看次数: |
283 次 |
| 最近记录: |