2

我在我的 htaccess 文件中有写规则,但是两个规则相互冲突。我的 htaccess 文件是:

# BEGIN REMOVE SLUG CUSTOM POST TYPE RULES
RewriteRule ^service-status/(.+)/$ /$1 [R=301,L]
RewriteRule ^country/(.+)/$ /$1 [R=301,L]
RewriteRule ^company/(.+)/$ /$1 [R=301,L]
# END REMOVE SLUG CUSTOM POST TYPE RULES


RewriteRule ^([a-zA-Z0-9_-]+)/numero/$ ?country=$1
RewriteRule ^introduction/([a-zA-Z0-9_-]+) ?company=$1
RewriteRule ^pays/(.+)?$ /pays?company=$1
RewriteRule ^([^/]*)/([^/]*)/$ /index.php?country=$1&company=$2

# BEGIN WordPress
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /ade/
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /ade/index.php [L]
</IfModule>

# END WordPress
all rule working fine but 
RewriteRule ^([^/]*)/([^/]*)/$ /index.php?country=$1&company=$2
RewriteRule ^([a-zA-Z0-9_-]+)/numero/$ ?country=$1
conflict each other both are working fine Individually   

我想要像 1 这样的网址。http://abc.com/country-name/companyname/

(RewriteRule ^([^/]*)/([^/]*)/$ /index.php?country=$1&company=$2)

2.http://abc.com/country-name/numero/(numero是固定关键词)

RewriteRule ^([a-zA-Z0-9_-]+)/numero/$ ?country=$1

我会感谢你的帮助。谢谢巴鲁

4

1 回答 1

1

尝试这个 :

# BEGIN REMOVE SLUG CUSTOM POST TYPE RULES
RewriteRule ^service-status/(.+)/$ /$1 [R=301,L]
RewriteRule ^country/(.+)/$ /$1 [R=301,L]
RewriteRule ^company/(.+)/$ /$1 [R=301,L]
# END REMOVE SLUG CUSTOM POST TYPE RULES


RewriteRule ^([a-zA-Z0-9_-]+)/numero/$ ?country=$1
RewriteRule ^introduction/([a-zA-Z0-9_-]+) ?company=$1
RewriteRule ^pays/(.+)?$ /pays?company=$1
RewriteRule ^([^/]*)/([^/]*)/$ /index.php?country=$1&company=$2

# BEGIN WordPress
<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /ade/
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /ade/index.php [L]
</IfModule>

# END WordPress
RewriteRule ^([a-zA-Z0-9_-]+)/numero/$ ?country=$1 [L]
RewriteRule ^([^/]*)/([^/]*)/$ /index.php?country=$1&company=$2 [L]
于 2012-10-25T11:39:29.787 回答