When I access my site using www.example.com/blog it redirects to example.com/?/blog.

How can I remove the question mark, so that the redirection just goes to example.com/blog?

My current .htaccess file:

RewriteEngine On
RewriteBase /

# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
  • 5
    Can you share your .Htaccess current code and website URL? Do you using php or wordpress? Oct 7 '15 at 5:57
  • My current htaccess can be access on, copasin.com/c/h/56165162eeece and my website url is jefryd.com I'm using ExpressionEngine Core. Oct 8 '15 at 11:17
  • The code you have posted should not redirect requests for /blog (they are internally rewritten). Only if you made a direct request (not an internal rewrite) for /index.php?/blog would it be externally redirect to /?/blog - at least according to the code above. So, there would seem to be something else triggering this redirect, or you are seeing a cached response?
    – MrWhite
    Jan 5 '16 at 0:18

Notice that you are rewriting URL to: /index.php?/$1. After this rewrite is done, the server removes index.php from URI. Thereby generating that URL. Just remove the ? from above rewrite.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
  • Oh ok i get it. But if i remove the ?, it would appear No files input specified. How can remove the index.php include the ? it self? Oct 16 '15 at 0:09
  • "After this rewrite is done, the server removes index.php from URI." - although the RewriteCond that checks against THE_REQUEST prevents this from happening. Only direct requests to index.php should get the index.php removed. (?)
    – MrWhite
    Jan 5 '16 at 0:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.