好的,有2个问题,
首先,我是 htaccess 的新手,在弄清楚如何为谷歌 SEO 制作好的重写 URL 时遇到了很多问题,所以我做了这个:
Options +FollowSymlinks
RewriteEngine on
### [... other language ...]
### English product URL
# Product page : (url/en/products/items-1.html)
RewriteRule ^([a-z]+)/[P-p]roducts/item-([0-9]+)\.html$ produits.php?lang=$1&art=$2 [L,NC]
# List of categories of a division (url/en/products/items-1-1.html)
RewriteRule ^([a-z]+)/[P-p]roducts/item-([0-9]+)-([0-9]+)\.html$ produits.php?lang=$1&idc=$2&catd=$3 [L,NC]
# List of subcategories of a categorie (url/en/products/items-1-1-1.html)
RewriteRule ^([a-z]+)/[P-p]roducts/item-([0-9]+)-([0-9]+)-([0-9]+)\.html$ produits.php?lang=$1&idc=$2&catd=$3&catt=$4 [L,NC]
# List of sub-sub-categories of a sub-categorie (url/en/products/items-1-1-1-1.html)
RewriteRule ^([a-z]+)/[P-p]roducts/item-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)\.html$ produits.php?lang=$1&idc=$2&catd=$3&catt=$4&catq=$5 [L,NC]
### Mod Rewrite to make url more friendly EN
RewriteRule ^([a-z]+)/[B-b]ecome-a-[C-c]lient client.php?lang=$1 [L,NC]
RewriteRule ^([a-z]+)/[C-c]ontact-[U-u]s contact.php?lang=$1 [L,NC]
RewriteRule ^([a-z]+)/[O-o]ops erreur.php?lang=$1 [L,NC]
RewriteRule ^([a-z]+)/[I-i]ndustrial-[D-d]ivision industriel.php?lang=$1 [L,NC]
RewriteRule ^([a-z]+)/[C-c]art panier.php?lang=$1 [L,NC]
RewriteRule ^([a-z]+)/[S-s]earch recherche.php?lang=$1 [L,NC]
RewriteRule ^([a-z]+)/[H-h]ealt-[D-d]ivision sanitaire.php?lang=$1 [L,NC]
RewriteRule ^([a-z]+)/[H-h]ome index.php?lang=$1 [L,NC]
### Compression Mod
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/php
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
## [... errors page ...]
现在的问题是,如果我要达到开发目的,我就做不到
示例:我将整个网站复制到一个名为 work 的文件夹中,该文件夹是域的根目录,因此 url 将是
www.website-url.com/work
此时一切都很好,我可以访问这部分,但是如果我要访问 products.php,我就可以做到......我知道我无法通过像 www.website-url.com/work 这样的重写来访问它/products/items-1.html 但我应该可以直接访问它吗?
我的第二个问题是我会为我的服务器使用压缩以使客户端的网站加载速度更快,因为我有很多 javascipt 与 jQuery 一起工作。但我不能让它工作,我用在线工具检查过,从来没有通过压缩测试。
谢谢你的帮助 !