.htaccess用于重写url影响web-dev文件夹

时间:2010-12-27 15:25:15

标签: apache .htaccess mod-rewrite deflate

好的,有两个问题,

首先,我是htaccess的新手,并且有很多问题想出如何为谷歌SEO制作好的Rewrited 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很多。但我无法使其工作,我已经使用在线工具进行了检查,并且从未通过压缩测试。

感谢您的帮助!

0 个答案:

没有答案