.htaccess rewrite for a new URL
New here? Learn about Bountify and follow @bountify to get notified of new bounties! x

I need a .htaccess permanent rewrite line that takes incoming requests like this:


And forwards the user to:


Should work for http or https.

awarded to Artem Shavrin

Crowdsource coding tasks.

1 Solution

something like this?

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^domain.com$ [NC]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTPS}:s on:(s)
RewriteRule ^sendy/(.*)$ http%1://newsletter.domain.com/$1 [R=301,QSA,L]

Kind of works. When I implement it in my htaccess file I get a redirect loop error in apache error log: "Request exceeded the limit of 10 internal redirects due to probable configuration error." Note, I have a general index.php route that comes after this new route. This is the full picture of what my .htaccess looks like: http://codeshare.io/26JOx
Difranco almost 5 years ago
Try to move down your RewriteCond %{REQUESTFILENAME} !-f and RewriteCond %{REQUESTFILENAME} !-d right before RewriteRule .* index.php/$0 [PT,L]
Artem Shavrin almost 5 years ago
That did it. Thanks!
Difranco almost 5 years ago