4 Replies - 604 Views - Last Post: 05 September 2014 - 10:37 AM

#1 Jessedb_  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 08-January 14

.htaccess problem

Posted 30 August 2014 - 04:21 AM

Hello everybody,

I've made a website, and ik want to hide de index.php.

It works, but when I Post a form (with php self) my index.php appears again.

Also when i type the url and put index.php after it, it's staying there.

Can somebody help me?

I have this code right now:

<IfModule mod_rewrite.c>
RewriteEngine On

# Send would-be 404 requests to Craft
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [QSA,L]
</IfModule>


Thank you in advance...

Is This A Good Question/Topic? 0
  • +

Replies To: .htaccess problem

#2 no2pencil  Icon User is online

  • Admiral Fancy Pants
  • member icon

Reputation: 5389
  • View blog
  • Posts: 27,386
  • Joined: 10-May 07

Re: .htaccess problem

Posted 30 August 2014 - 04:27 AM

.htaccess is not related to php. Moved to Web Servers & Hosting.
Was This Post Helpful? 0
  • +
  • -

#3 Jessedb_  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 08-January 14

Re: .htaccess problem

Posted 31 August 2014 - 03:36 AM

Anybody Please?

Thank you...
Was This Post Helpful? 0
  • +
  • -

#4 ArtificialSoldier  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 485
  • View blog
  • Posts: 1,816
  • Joined: 15-January 14

Re: .htaccess problem

Posted 02 September 2014 - 03:23 PM

For the form issue, just don't put "index.php" in the form action. For the other issue, you would need to add a rule in .htaccess to check for index.php and redirect to the URL you want without it.
Was This Post Helpful? 0
  • +
  • -

#5 Sheepings  Icon User is offline

  • D.I.C Addict

Reputation: 73
  • View blog
  • Posts: 571
  • Joined: 05-December 13

Re: .htaccess problem

Posted 05 September 2014 - 10:37 AM

I don't know if you got this fixed or not, but depending on which OS you are using, there are two ways this can be done. On Linux, its as straight forward as editing the .htaccess file, but on windows, you will need to do this in IIS, assuming you are on Linux from your post, you can use:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.+) index.php?p=$1 [QSA,L]

This only means that if the file name in the url doesn't exist, or the directory URL doesn't exist, then proceed to the rewrite rule below it. In your case; your url does exist.

Edit: Typo

This post has been edited by Sheepings: 05 September 2014 - 10:54 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1