Possible Duplicate:
My web host is adding ?PHPSESSID=fgh2h45… to the end of the URL
How I can remove PHPSESSID in Symfony2
I develloped my website with Symfony 2,so I tried to remove PHPSESSID from URLs and I put In /web/.htaccess this code :
SetEnv SHORT_OPEN_TAGS 0
SetEnv REGISTER_GLOBALS 0
SetEnv MAGIC_QUOTES 0
SetEnv SESSION_AUTOSTART 0
SetEnv ZEND_OPTIMIZER 1
SetEnv PHP_VER 5_4
DirectoryIndex app.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
#remove PHPSESSID
RewriteCond %{QUERY_STRING} PHPSESSID=.*$
RewriteRule .* %{REQUEST_URI}? [R=301,L]
</IfModule>
then I remark the code above disable the PHPSESSID,but it creat another problem,I have app.php appears in all URLs of my website :
www.mysite.com/app.php/.....
So I dont know what I can do,I guess I have the new problem because I used a multiple RewriteRule.
You are rewriting the URI to
app.phpbefore you are doing the redirect that removes thePHPSESSIDfrom the query string. You want to do that before so that the%{REQUEST_URI}doesn’t get rewritten.Try replacing everything under
DirectoryIndex app.phpwith this: