#only for the root directory
RewriteCond %{REQUEST_URI} ^/$
#if the uri is not already index.php
RewriteCond %{REQUEST_URI} !^/index.php [NC]
RewriteRule ^$ /index.php [R=301,L]
My question is, I have directories, were a user to go to the url bar and type
#only for the root directory
RewriteCond %{REQUEST_URI} ^/fr/$
#if the uri is not already index.php
RewriteCond %{REQUEST_URI} !^/fr/index.php [NC]
RewriteRule ^$ /fr/index.php [R=301,L]
Thank you
I use permalinks in my multi lingual site. thus. for a french version of my site, I have the same index.php page filtered aka index.php?=3 is permalinked to mysite.com/fr/index.php
now if a user goes direct to mysite.com/fr/index.php, they see the french version of my site, and all looks lovely. but were a user to go to mysite.com/fr/ then wowa nothing happens and they get a 404 as the permalinks do not kick in. thus…I managed to sort it. lol gosh I feel so clever (me joking)
cheers
#only for the root directory
RewriteCond %{REQUEST_URI} ^/$
#if the uri is not already index.php
RewriteCond %{REQUEST_URI} !^/index.php [NC]
RewriteRule ^$ /index.php [R=301,L]
## created by me, this redirects a user that comes to mysite.com/fr/ to mysite.com/fr/index.php
RewriteRule ^/?fr/.*$^ fr/index.php [R=301,L]
RewriteRule ^/?fr.*$^ fr/index.php [R=301,L]
I struggle with htaccess rewrite rules I have to say. However, the ^/?fr.*$^ looks unnecessarily complicated. Have you tired something more like /fr/ ?
BTW your browser should affect the result as the .htaccess processing is all on the server.
the above did the trick haha I cleared out my cache many times and tested on different browsers.
re TechnoBear
Yes I did try that but it got me into other error issues thus. having weighed up my options, lol you know how it is, sometimes you have to do something a little different.
Thank you Gandalf, I did try that and ended up with /fr/index.php/index.php/index.php/index.php/index.php or something like that anyway. I made a list of what I tried but not of all the errors, when I discovered something didnt work I just swore and tried again. you know how it is.