I'm trying to solve some htaccess question and I'm not able to reach the solution. I have the following html:
<a href="www.site.com/home.php?Idi="English">English</a>
<a href="www.site.com/home.php?Idi="Française">Française</a>
and the goal is that user just gets in its address bar:
www.site.com/home/English
or
www.site.com/home/Française
Obviously, the get variables should arrive to home.php to be processed.
Also, the site has other pages with extension .php and I got delete each extension with:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
Further, I would like the starting page:
www.site.com/home.php
would show as:
www.site.com/home/English
I have seen a lot of tutorials and posts concerning it, but I am not able to solve it.
Any help would be appreciated, thanks
EDITED:
Finally, as UnskilledFreak suggested me, I changed the original links to:
<a href="www.site.com/home/English">English</a>
<a href="www.site.com/home/Française">Française</a>
and the htaccess is as:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
#Receive site.com/home/Language and internally processes site.com/home.php?Idi=Language
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^home/(English)/?$ home.php?Idi=English [QSA,NC,L]
RewriteRule ^home/(Française)/?$ home.php?Idi=Française [QSA,NC,L]
#Receive site.com/something and internally goes to site.com/something.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^ %{REQUEST_URI}.php [L]
To avoid the crash of css, js and other links loaded in new pages, I added a /
before every path of the html.
The htaccess is placed in the root. The 'home' folder doesn't exist in the server.
Like the comments explain AND the edited Post above, it'll work ;)
but here is another solution i get and works too:
in my document_root i've added a folder called
test
, in there i've got 4 files with following content:.htaccess
index.php
- a wrapper for rewrite and testlinkshome.php
- as requestedstyle.css
- only as test that file access will worktested and works as expected :)