0

I'm hoping someone can help me here. I'm currently trying to make my site more SEO friendly and having some strange issues with .htaccess.

This is all on my testing server. The designer section was working fine without "homeware-designer/" preceding the designer name "cquoi, etc". All good until I added the last one mage then it all stopped working, relative links were no longer working properly. I removed RewriteRule mage designerdata.php?search=4 and it all started working again. Once I added homeware-designer/etc all works fine again???? Can anyone tell me what might be going on. Also some of the rules won't work without ^foo$, but most will work without the ^$ delimiters and most will not work at all with the ^$ string delimiters. I just need to understand what is going on before I try to put it on the live server.

Options +FollowSymLinks -Indexes
RewriteEngine on

RewriteBase /

RewriteRule designer-homeware index.php  

#------------------ Living ---------------
RewriteRule living-room-hallway category.php?collection=1 

RewriteRule designer-shelves-storage contentdata.php?collection=1&type=17 

RewriteRule designer-cushions-pouffes contentdata.php?collection=1&type=1 

rewriterule designer-coat-hat-racks contentdata.php?collection=1&type=19 

rewriterule designer-lighting contentdata.php?collection=1&type=25 

rewriterule living-room-accessories contentdata.php?collection=1&type=4 

#----------------- Eating ----------------
RewriteRule dining-room-eating category.php?collection=2 

rewriterule designer-tableware contentdata.php?collection=2&type=5 

rewriterule designer-glassware contentdata.php?collection=2&type=6 

rewriterule dining-room-accessories contentdata.php?collection=2&type=8 

#----------------- Bathing ----------------
RewriteRule ^bathroom$ category.php?collection=5 

RewriteRule bathroom-accessories contentdata.php?collection=5&type=11

#----------------- Kids -------------------
RewriteRule ^childrens-decor$ category.php?collection=6 

RewriteRule ^designer-childrens-decor$ contentdata.php?collection=6&type=20 

#----------------- Garden ------------------
RewriteRule garden category.php?collection=7 

RewriteRule garden-accessories contentdata.php?collection=7&type=21

#----------------- Art ---------------------
rewriterule designer-prints contentdata.php?collection=8&type=24 

#----------------- Designers --------------
RewriteRule homeware-designers designer.php

RewriteRule homeware-designer/cquoi designerdata.php?search=7

RewriteRule homeware-designer/remember designerdata.php?search=8

RewriteRule homeware-designer/terafue designerdata.php?search=10

RewriteRule homeware-designer/r-bernier designerdata.php?search=11

RewriteRule homeware-designer/c-l-boym designerdata.php?search=21

RewriteRule homeware-designer/andre-klauser designerdata.php?search=22

RewriteRule homeware-designer/shin-azumi designerdata.php?search=23

RewriteRule homeware-designer/alejandro-ruiz designerdata.php?search=24

RewriteRule homeware-designer/tord-boontje designerdata.php?search=25

RewriteRule homeware-designer/sibo-home-concept designerdata.php?search=13

RewriteRule homeware-designer/zafferano designerdata.php?search=14

RewriteRule homeware-designer/klevering designerdata.php?search=15

RewriteRule homeware-designer/dutch-waaren designerdata.php?search=16

RewriteRule homeware-designer/vintage-casa designerdata.php?search=17

RewriteRule homeware-designer/hubsch-denmark designerdata.php?search=18

RewriteRule homeware-designer/serholt-sweden designerdata.php?search=19

RewriteRule homeware-designer/lazis designerdata.php?search=20

RewriteRule homeware-designer/atlantis designerdata.php?search=26

RewriteRule homeware-designer/mage designerdata.php?search=4
4

1 回答 1

0

对于这些确切的 url 规则,最好包含^$分隔符。需要^$分隔符的问题是某些规则是其他规则的子集。例如,如果您没有分隔符,该bathroom规则将捕获 url 。bathroom-accessories一般来说,如果您知道这是您想要的整个确切 url,最好有分隔符。

另一个问题是这些规则都在被检查,即使它们匹配。在大多数情况下,这不是问题,但就像浴室一词一样,有些可能会在多个规则上匹配。要解决此问题,请将其放在[L]规则的末尾,以表明它是 Last 规则,如果它匹配 - 也就是说,它说如果它匹配,则完成并退出。

通常还包括一个NC标志,对于无大小写,不关心它是大写还是小写。

RewriteRule designer-homeware index.php [NC,L]

#------------------ Living ---------------
RewriteRule living-room-hallway category.php?collection=1 [NC,L]

RewriteRule designer-shelves-storage contentdata.php?collection=1&type=17 [NC,L]

etc.

试试这个,看看它是否有帮助。我没有特别看到法师规则有什么问题,但是 L 和分隔符至少可以防止规则相互重叠。

于 2013-05-30T04:01:07.770 回答