php - 如何从 Piwigo 中删除 index.php 和 picture.php?
问题描述
https://example.com/index.php/categories
在 url index.php 上看起来不太好。如何从 url 中删除 index.php?
https://example.com/picture.php?/246/category/red-color-women-shoes
"picture.php?"
- 想要删除友好的网址
/246/
- 不确定它是什么。
/category/
- 我认为它应该是类别名称,但显示“类别”
Piwigo 是用于网络的开源照片库软件 https://piwigo.org/
https://example.com/index.php/categories
https://example.com/picture.php?/246/category/red-color-women-shoes
$conf['question_mark_in_urls'] = false;
$conf['php_extension_in_urls'] = false; // this does not work
$conf['category_url_style'] = 'id-name';
$conf['picture_url_style'] = 'file';
网址应该是
https://example.com/categories
和
https://example.com/category-name/red-color-women-shoes
解决方案
#TURN ON REWRITES
RewriteEngine on
RewriteBase /
#THEN OPTIONALLY MAKE IT www if they didnt enter it
RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$ [NC]
RewriteRule ^(.*) https://www.example.com/$1 [R=301,L]
#Write index.any to /
RewriteRule ^index\.[a-z]{2,3} / [L,R=301]
#THEN REWRITE LOCATIONS
RewriteRule ^([0-9]+)/category/(.*)$ picture.php?id=$1&page_url=$2 [L]
#IF CATEGORY IS ALSO DYNAMIC THEN TRY THIS FOR REWRITE
RewriteRule ^([0-9]+)/(.*)/(.*)$ picture.php?id=$1&category=$2&page_url=$3 [L]
如果我正确理解您的问题..希望对您有所帮助
推荐阅读
- mysql - 我需要找到一种方法来优化从多个数据库表中提取 laravel 中的数据
- python - 根据测试的标签在关键字中包装机器人框架中的测试用例
- angular - 角度检查值是否在角度模板的数组中
- google-picker - 如何使用 Flutter 将 Google Picker 与 Google Drive 结合使用
- ios - React-Native 状态不更新
- rabbitmq - NServiceBus 延迟重试仅在一个队列上配置
- ibm-midrange - SYSPARTITIONSTAT 中缺少 PF
- c# - Visual Studio 中的静默错误 SQL80001(SQL Server 工具)
- python - 将 JSON 对象导入 MySQL 列的问题
- spring-boot - 将 Svelte 捆绑为带有资产(如图像、svg 文件)的 Web 组件