Link to home
Start Free TrialLog in
Avatar of Robert Granlund
Robert GranlundFlag for United States of America

asked on

htaccess redirect

I'm having a hard time figuring out a simple redirect.
if someone comes to my site with the url:
https://www.MYSITE.com/Partners

I want to forward them to:
https://www.MYSITE.com/index.php/my_partners
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Have you tried this?
RewriteRule ^(.*) index.php/my_$1

Open in new window


This is not complete because we don't know what all the combinations of your URL's might be - for instance what happens to
https://www.MYSITE.com/Partners/SomethingElse

Open in new window

Avatar of Robert Granlund

ASKER

Does not matter.  I just want that one re-direct.
Then try this
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^Partners$ index.php/my_partners [L,NC]

Open in new window

Is this correct cause it does not seem to work
<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]

	RewriteRule ^Partners$ index.php/spoke_partner [L,NC]
</IfModule>

Open in new window


You can see here:
https://www.spokeinsurance.com/Partners
It won't  - the first rule will match before the Partners rule and it has a [L] which means don't process any other rules.

Move your last Rewrite before the first like this

<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
	RewriteRule ^Partners$ index.php/spoke_partner [L,NC]
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

Open in new window

Still no luck./  It is a windows IIS server if that matters.
It does matter.  I believe the code above is for Apache, not IIS.  Here is the page for IIS Url-rewrite http://www.iis.net/downloads/microsoft/url-rewrite .  There is a list of articles on the right side of that page.
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
But I am confused, you have another rule there

RewriteRule ^(.*)$ /index.php/$1 [L]

Open in new window


Which I assume is working or else your site would not be working - so can you clarify?