sorry for asking a question but it drives me crazy i'm working a week on this issue but i haven't found a solution, i have a website with two languages , exp( de ,en ) i wanted to disable and enable this option in a panel and my RewriteRule applies the both conditions ,
for example if i have "localhost/test/en/admin" working this url works as well "localhost/test/admin"
so i edited my htaccess file in my root directory (note: i don't use public directory i use an index file inside of my root directory)
i have two htaccess files one in my root directory one in my public directory
and roots are as below
root:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
public:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
ok , when i load http://localhost/test/ everything is good , i have my stylesheets everything
but when i use http://localhost/test/en everything that contains urls broke , my domain name removes from my "url" helper function and instead when i call App::getLocale(), the return value is my domain name instead of my lang var!
//+++++++++++++++++++++++++++++++++++++++++++++++
this is my previous htacess file for my root directory
root:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]
and i had this issue every url would map to index.php and i coudnt handle it with 404 error
for example "localhost/test/en" was a valid url and "localhost/test/foo" was a valid url just showing my index page of site ! and i coudnt handle a url without lang code ,
"localhost/test/en/foo" would get 404 error but "localhost/test/foo" just the index page
i'm very confused and i dont know how to handle this , thanks in advance
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire