无法访问子域的子页面URL

时间:2021-04-19 11:03:00

I did a rewrite rule for wildcard subdomain access to allow me to access any countries of my list page as follows:

我为通配符子域访问做了重写规则,允许我访问列表页面的任何国家/地区,如下所示:

    RewriteCond %{HTTP_HOST}    ^(.+)\.mydomain\.net$
    RewriteCond %{HTTP_HOST}    !^www\.mydomain\.net$
    RewriteCond %{REQUEST_URI}  !^.*\.(jpe?g|png|gif|bmp)$ [NC]
    RewriteRule (.*)            pages/list.php?country=%1 [L]

This is working fine.

这工作正常。

Now. I do a rewrite rule to access another page on the domain but i keep getting referred back to the list page.

现在。我做了一个重写规则来访问域上的另一个页面,但我不断被引回到列表页面。

    RewriteRule    ^ad/([A-Za-z0-9-]+)?$        pages/details.php?alias=$1                                          [NC,L]

My end result is to access eg: http://us.mydomain.net/ad/alias but it keeps referring me back to the list page.

我的最终结果是访问例如:http://us.mydomain.net/ad/alias但它一直将我引回到列表页面。

UPDATED REWRITE RULES(AS OF 14 MAY)

更新的重写规则(截至5月14日)

        RewriteEngine on

        <IfModule mod_headers.c>
           Header set Access-Control-Allow-Origin "*"
        </IfModule>

        RewriteRule ^cat/([A-Za-z0-9-]+)/?$ ?category=$1 [L,QSA,NC]

        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{HTTP_HOST}    ^(.+)\.ibizportal\.net$
        RewriteCond %{HTTP_HOST}    !^www\.ibizportal\.net$
        RewriteCond %{REQUEST_URI}  !^.*\.(jpe?g|png|gif|bmp)$ [NC]
        RewriteRule (.*)            pages/list.php?country=%1 [L]

1 个解决方案

#1


Change first rule to:

将第一条规则更改为:

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^cat/([A-Za-z0-9-]+)/?$ ?category=$1 [L,QSA,NC]

RewriteCond %{HTTP_HOST} ^((?!www).+)\.mydomain\.net$ [NC]
RewriteCond %{REQUEST_URI} !\.(?:jpe?g|png|gif|bmp|php)$ [NC]
RewriteRule (.+) pages/list.php?country=%1 [L,QSA]

#1


Change first rule to:

将第一条规则更改为:

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^cat/([A-Za-z0-9-]+)/?$ ?category=$1 [L,QSA,NC]

RewriteCond %{HTTP_HOST} ^((?!www).+)\.mydomain\.net$ [NC]
RewriteCond %{REQUEST_URI} !\.(?:jpe?g|png|gif|bmp|php)$ [NC]
RewriteRule (.+) pages/list.php?country=%1 [L,QSA]