ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Remove index.php and redirecting

September 03, 2010 8:22pm

Subscribe [1]
  • #1 / Sep 03, 2010 8:22pm

    Hi all,

    Here comes a quite complicated issue.

    I remove index.php from my website by using the Exclude method. Hosting provider (Engine Hosting) says it is the only permitted way on their servers.

    Now I also want to create a redirection.
    The following code in my htaccess file aims to redirect all entries in template_group/template_name to a new directory, called v1. So I write:

    #Redirect
    RewriteEngine on
    RewriteRule ^template_group/template_name/(.*)$ <a href="http://mydomain.com/v1/index.php/template_group/template_name/$1">http://mydomain.com/v1/index.php/template_group/template_name/$1</a>

    This works perfectly well alone. But it doesn’t work with the code for the Exclude method.

    - If I put first the code above I get a 302 Found error.
    - If I put first Exclude method code (without the final [L] which signifies the last rule to execute) I get a 404 page.

    I know it is not simple but I hope for a solution. Any help would be much appreciated.

    (We’re talking about 2 installations of EE. mydomain.com uses EE 2.1 and in v1 directory there’s an 1.6.8 installation.)

    [Mod Edit: Moved to the CodeShare Corner forum]

  • #2 / Sep 07, 2010 11:27am

    Found out what happened.
    Here is my .htaccess file:

    #Redirect
    RewriteEngine on
    RewriteRule ^template_group/template_name/(.*)$ <a href="http://mydomain.com/v1/index.php/template_group/template_name/$1">http://mydomain.com/v1/index.php/template_group/template_name/$1</a> [301,L]

    Then comes the code for the Exclude Method.

    In other words all I needed to do is to add [301,L] in the end of the rewrite rule.

    Dear moderators consider this issue solved. If you think it could be added to the Wiki please tell me to do so.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases