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?
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?

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.
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>
<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>
I figured out a simple way:
RedirectMatch 301 ^/company/?$https://www.mydomain.com/company/about/...
RedirectMatch 301 ^/company/?$https://www.mydomain.com/company/about/...
I tried this solution and its just broke my site. I know this is old but did you ever find a solutions for this.
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):
or this:
If you still have a problem, post a copy of your .htaccess
-- John
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
Thanks. It looks like all the redirects are working now. My spacing was just off. Thanks for the help.
Glad to hear you got it working.