2

I have two weird scenarios concerning index.php in my url. For the most part, it is removed from the url. The two times when index.php reappears in the url is in form return. I'm using Freeform Pro.

My form code:

{exp:freeform:form  
   form_id="5"
   form:id="freeform"
   require_ip="yes" 
   prevent_duplicate_on="email"
   return="/template_group/template/review/%%entry_id%%"
}

My .htaccess code:

<IfModule mod_rewrite.c>
  RewriteEngine on 
  RewriteCond %{REQUEST_URI} !^/system [NC]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.+)/$ /$1 [R=301,L,QSA]
  #
  RewriteCond %{QUERY_STRING} ^(ACT=.*)$ [NC,OR]
  RewriteCond %{QUERY_STRING} ^(URL=.*)$ [NC,OR]
  RewriteCond %{QUERY_STRING} ^(CSS=.*)$ [NC]   
  RewriteRule ^(.*)$ /index.php\?&%{QUERY_STRING} [L]  
  #
  RewriteCond $1 !^(images|assets|bootstrap|system|upd|themes|index\.php|admin\.php) [NC]
  RewriteRule ^(.*)$ /index.php/$1 [L]
  #
  RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]\
  RewriteCond %{REQUEST_FILENAME} !-f 
  RewriteCond %{REQUEST_FILENAME} !-d 
  RewriteRule ^(.*)$ /index.php/$1 [L]
  #
  #------------------- index.php -------------------
  #strip index.php/* from the URL
  RewriteCond %{THE_REQUEST} ^[^/]*/index\.php/ [NC]
  #RewriteRule ^index\.php/(.+) http://%{HTTP_HOST}/$1 [R=301,L,QSA]
</IfModule>

I commented out the 2nd to last line of the .htaccess code recently because it was preventing FreeMember's "forgot password" code to work.

Any help would be appreciated as I'm not a pro with .htaccess (I know, ).

Thanks!

Peter T

2 Answers 2

3

It was ALL ME! I hate it when operator error is the case!

In my general preferences, the name of my sites homepage was set to index.php instead of /.

My bad! This was definitely an unnecessary post!

1
  • 1
    No worries. Thanks for coming back to post your solution, hopefully it will point others in the right direction :) Commented Oct 21, 2013 at 17:45
1

You have a lot going in there. To completely remove index.php for the entire site, try this:

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Removes index.php
  RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php/$1 [L]    
</IfModule>
1
  • 1
    Thank you Stephen! While this works for the most part, once I click submit on my Freeform, the index.php reappears in the return url. Weird!
    – user1469
    Commented Oct 21, 2013 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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