.htaccess redirect loop with RewriteCond

.htaccess redirect loop with RewriteCond



I am trying to redirect a specific page



http://www.my.website/admin


http://www.my.website/admin



to



https://my.website/admin/


https://my.website/admin/



using this code:


Redirect 301 /admin/ https://my.website/admin/



but it keeps looping and I can not find out why as I have specified the condition for 'www' not to be present.


<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %HTTP_HOST ^www.tci.rocks$ [NC]
RewriteRule ^admin/?$ https://my.website/admin/ [L,R=301]
</IfModule>

# BEGIN WithoutWWW
RewriteEngine on
RewriteCond %HTTPS !=on
RewriteCond %HTTP_HOST ^www.(.+)$ [NC]
RewriteRule ^ https://%1%REQUEST_URI [R=301,L]
# END WithoutWWW

# BEGIN YOURLS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^.*$ /yourls-loader.php [L]
</IfModule>
# END YOURLS

<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>



How can i make this .htaccess stop looping ??




1 Answer
1



Use instead:


<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %HTTP_HOST ^www.my.website$ [NC]
RewriteRule ^admin/?$ https://my.website/admin/ [L,R=301]
</IfModule>






i will choose yours as final answer next week when i test it. thank you

– Mau
Sep 14 '18 at 7:39






Ok, no problem !

– Croises
Sep 14 '18 at 9:46






my test are showing no joy.

– Mau
Sep 17 '18 at 3:30






i will now edit the question to reflex 100% what is on the live server, temporarily. then when all is clear, i will revert back to generic. thank you

– Mau
Sep 17 '18 at 3:31






What exactly is your problem or error message?

– Croises
Sep 18 '18 at 11:42



Thanks for contributing an answer to Stack Overflow!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

How do I collapse sections of code in Visual Studio Code for Windows?

Node.js puppeteer - Use values from array in a loop to cycle through pages