php - 应用 .htaccess 后我的页面样式消失了
问题描述
美好的一天,我完成了一个项目,我正在尝试重写我尝试过的 url(静态和动态)
RewriteEngine on
RewriteRule ^home index.php [L]
RewriteRule ^contact contact-us.php [L]
RewriteRule ^blog blog.php [L]
他们都运作良好。直到我在看起来像这样的动态 url 上尝试了同样的事情。
RewriteRule ^category/([0-9]+) single-mp3.php?uid=$1 [L]
在尝试了上述方法之后,它起作用了,但我的造型消失了。我也试过。
RewriteRule ^[a-zA-Z]+/([0-9]+)/?$ single-mp3.php?uid=$1 [L]
然而它并没有解决我的问题请帮帮我
解决方案
认为这就是你所追求的:
RewriteEngine on
RewriteRule ^home index.php [L]
RewriteRule ^contact contact-us.php [L]
RewriteRule ^blog blog.php [L]
RewriteRule ^category/(.*)$ single-mp3.php?uid=$1 [L]
结果是:
curl 'http://localhost/home?query='
=> index
curl 'http://localhost/contact?query='
=> contact
curl 'http://localhost/blog?query='
=> blog
curl 'http://localhost/category/someid'
=> Array
(
[uid] => someid
)
curl 'http://localhost/css/bootstrap.css'
=> css
推荐阅读
- vba - 从Word VBA中的txt文件动态导入文本
- jmeter - 如何使用 JMeter 的 while 循环来验证采样器中需要再次执行的值?
- node.js - 使用 ApolloClient 和 Apollo-Server-Express 处理 GraphQL 错误
- linux - Linux 目录访问权限
- php - 使用 python 脚本将图像上传到 php 数据库
- bash - 如何使用重定向的标准输入、标准输出和标准错误保持 LLDB 运行
- javascript - 我怎样才能允许用户只输入字母和特殊字符而不是整数或数字
- eclipse - FROM 子句中的 Eclipse BIRT 输入参数
- android - setPersistenceEnabled(true) 从 BroadcastReceiver 调用时应用程序崩溃
- php - 未捕获的 PDOException:SQLSTATE [42S22]:在 PHP 代码中找不到列