Используйте Mod_Rewrite для перезаписи КОРНЯ к другому пути

Примечание: Я попробовал предложения под этим вопросом, но они или не работают или дают мне бесконечную ошибку цикла перенаправления.

У меня есть следующее в моем .htaccess файле:



    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    # Rewrite old links to new
    Redirect 301 /howitworks.php        /how-it-works
    Redirect 301 /testimonials.php      /testimonials
    Redirect 301 /contact_us.php        /customer-service
    Redirect 301 /affiliates.php        /affiliates
    Redirect 301 /account.php           /customer/account
    Redirect 301 /shopping_cart.php     /checkout/cart
    Redirect 301 /products.php          /starter-kits
    Redirect 301 /login.php             /customer/account/login

    # Force to Admin if trying to access admin
    RewriteCond %{HTTP_HOST} www\.example\.com [NC]
    RewriteCond %{REQUEST_URI} admin [NC]
    RewriteRule ^(.*)$ https://admin.example.com/index.php/admin [R=301,L,QSA]

    # Compress, Combine and Cache Javascript/CSS
    RewriteRule ^(index.php/)?minify/([^/]+)(/.*.(js|css))$ lib/minify/m.php?f=$3&d=$2

    # Always send 404 on missing files in these folders
    RewriteCond %{REQUEST_URI} !^/(media|skin|js)/

    # Never rewrite for existing files, directories and links
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteCond %{REQUEST_URI} !server-status

    # Rewrite everything else to index.php
    RewriteRule .* index.php [L]

    # Force www in url and non-example domains to example
    RewriteCond %{HTTP_HOST} !^www\.example\.com [NC]
    RewriteCond %{HTTP_HOST} !^ww2\.example\.com [NC]
    RewriteCond %{HTTP_HOST} !^qa\.example\.com [NC]
    RewriteCond %{HTTP_HOST} !^uat\.example\.com [NC]
    RewriteCond %{HTTP_HOST} !^local\.example\.com [NC]
    RewriteCond %{HTTP_HOST} !^admin\.example\.com [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L,QSA]


Мне нужно переписывание, которое сделает следующее:

Перепишите: http://subdomain.example.com/ на http://subdomain.example.com/page

Я также хотел бы, чтобы это скрылось, / страница (/будет действовать, как будто это была / страница), но это не необходимое требование. Кроме того, я хотел бы, чтобы это работало с HTTP или HTTPS.

Любая справка значительно ценится, потому что я боролся с этим в течение многих часов.

15
задан Community 23 May 2017 в 12:02
поделиться