My URL looks something like this:
example.com/index.php?redirected=1
in my .htaccess-file, I want to remove the last part of my url.
I wrote that:
RewriteCond %{HTTP_HOST} ^example.com\/index.php\?redirected=1$
RewriteRule ^(.*) http://www.example.com/$1 [L,R=301]
But for some reason, it isn't working. It is right after the line:
RewriteEngine on
RewriteBase /
I found similar questions, but that didn't do the trick. Thanks
With this code in the .htaccess-file, it redirects me to: www.example.com/index.php
RewriteCond %{THE_REQUEST} \ /+(.*)\?redirected=1&?([^\ ]*)
RewriteRule ^ /%1?%2 [L,R]
When i remove the %2 (which i thought was the index.php-part, it'll result in infinte redirects.
Update: I updated the regexp like this:
RewriteCond %{THE_REQUEST} \ /+(.*)\?redirected=1&?([^\ ]*)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
still the "index.php" in the end