how to redirect webpage in .htaccess (with pretty urls enabled)?

Permalink
I'm trying to use the technique from here:

http://www.concrete5.org/community/forums/customizing_c5/301-redire...

as follows (placed after pretty url block in htaccess file)....

<IfModule mod_rewrite.c>
Redirect 301 /companyhttps://www.mydomain.com/company/about/...
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

but when I navigate tohttp://www.mydomain.com/company/ I get a "page isn't redirecting properly" error msg in the browser, and it's url appears as

https://www.mydomain.com/company/about//about//about//about//about//...

Basically, I want, after pretty urls execute in htaccess, the following address

https://www.mydomain.com/company/...

to redirect to

https://www.mydomain.com/company/about/...

Anyone know how to do this?

 
exchangecore replied on at Permalink Best Answer Reply
exchangecore
Hmmm... maybe it's because you don't have a trailing / on your redirect rule, but you are visiting the url with a trailing forward slash? Just guessing, you could try visitinghttp://www.mydomain.com/company... and see if it redirects you.
jwapp replied on at Permalink Reply
I tried, and adding or removing the trailing slash in company didn't change anything. I thought the pretty url code, which executes before the other code above, handled both with and without the trailing slash, so I wasn't expecting it to matter. Correct me if I'm wrong. The pretty url code:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
jwapp replied on at Permalink Reply
I figured out a simple way:

RedirectMatch 301 ^/company/?$https://www.mydomain.com/company/about/...
stewblack23 replied on at Permalink Reply
stewblack23
I tried this solution and its just broke my site. I know this is old but did you ever find a solutions for this.
jasteele12 replied on at Permalink Reply
jasteele12
This could be due to concrete5.org forum URL mangling.

Try making the above line look like this (space/tab after $ without the ... at the end):
RedirectMatch 301 ^/company/?$  https://www.mydomain.com/company/about/

or this:
Redirect 301 ^/company$  https://www.mydomain.com/company/about/  
Redirect 301 ^/company/$  https://www.mydomain.com/company/about/

If you still have a problem, post a copy of your .htaccess

-- John
stewblack23 replied on at Permalink Reply
stewblack23
Thanks. It looks like all the redirects are working now. My spacing was just off. Thanks for the help.
jasteele12 replied on at Permalink Reply
jasteele12
Glad to hear you got it working.