Url友好又不失风格css/js/images
Url friendly without losing styles css / js / images
我的网站过于广泛,编辑 URL 样式 css
和文件 js
、images
会花费我太多时间。
我在 localhost 工作
localhost/project/index.php
友情url我想拥有:
localhost/project/index/
由此url
localhost/project/online.php
至此
localhost/project/online/video/hd/free/
我观察了这个网站http://crazycafe.net/demos/seo/及其源代码,样式css
是这样维护的:<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
不向样式 css
及其文件和 images
.
添加 绝对 URL
如何通过这种方式创建友好的url?
如果用户这样修改url:
http://crazycafe.net/demos/seo
重定向到这种方式:
http://crazycafe.net/demos/seo/
另一方面,就像保存样式 css
文件 js
和 images
,而不必修改为绝对路径。
我的文件目录是:
assets/css/style.css
assets/js/app.js
assets/fonts/icons/image.png
assets/fonts/ttf/roboto.ttf
assets/img/system/image.png
assets/img/logo.png
注:
我在 SO 中找到了这个 question,关于如何保存 CSS 样式。
但是我不懂使用友好URL - .httaccess
您需要开启mod_rewrite并使用它。示例:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^folder1.*$ http://example.com/ [R=301,L]
基于文件夹的示例:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^folder1/(.*)$ http://gs.mt-example.com/folder2/ [R=301,L]
您的情况:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^online.php$ project/online/video/hd/free/ [R=301,L]
查看更多here.
我的网站过于广泛,编辑 URL 样式 css
和文件 js
、images
会花费我太多时间。
我在 localhost 工作
localhost/project/index.php
友情url我想拥有:
localhost/project/index/
由此url
localhost/project/online.php
至此
localhost/project/online/video/hd/free/
我观察了这个网站http://crazycafe.net/demos/seo/及其源代码,样式css
是这样维护的:<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
不向样式 css
及其文件和 images
.
如何通过这种方式创建友好的url?
如果用户这样修改url:
http://crazycafe.net/demos/seo
重定向到这种方式:
http://crazycafe.net/demos/seo/
另一方面,就像保存样式 css
文件 js
和 images
,而不必修改为绝对路径。
我的文件目录是:
assets/css/style.css
assets/js/app.js
assets/fonts/icons/image.png
assets/fonts/ttf/roboto.ttf
assets/img/system/image.png
assets/img/logo.png
注:
我在 SO 中找到了这个 question,关于如何保存 CSS 样式。
但是我不懂使用友好URL - .httaccess
您需要开启mod_rewrite并使用它。示例:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^folder1.*$ http://example.com/ [R=301,L]
基于文件夹的示例:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^folder1/(.*)$ http://gs.mt-example.com/folder2/ [R=301,L]
您的情况:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^online.php$ project/online/video/hd/free/ [R=301,L]
查看更多here.