Can you help me with .htaccess
May 25, 2006 7:32 PM   Subscribe

Help with modifying an .htaccess file. I'm on Dreamhost and using Expression Engine, if that makes any diff.

Disclaimer: I know nothing of the .htaccess thingy and have never touched it before. Please explain as if speaking to an idiot!

I use the Expression Engine CMS which defaults to putting index.php in a url, like this:

www.mydomain.com/index.php/template/

According to this page in the EE wiki, I can configure .htaccess to omit the index.php so it looks like this

www.mydomain.com/template/

However, I cannot make head nor tail of the instructions there.

I use Dreamhost as my host and do not see an .htaccess file in the root. They do have .htaccess in their control panel and when I click it it asks me to create a new directory.

Hence, I'm lost.

Any suggestions?
posted by You Should See the Other Guy to Computers & Internet (11 answers total)
 
If you're connecting via FTP, you might need to turn on a preference in your FTP client to show "invisible files," files that start with "." like .htacess. If you're using webftp.dreamhost.com, those files should show up automatically. If you don't see any .htaccess file, you just need to create a new one. Then you need to add something like this to the file:

RewriteEngine On
RewriteRule ^/template/(.*)$ /index.php/template/$1

(I haven't tested that, so it may be wrong.)
posted by scottreynen at 7:50 PM on May 25, 2006


Response by poster: scottreynen, the wiki lists this code:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

However, when I save it to a file and call the file .htaccess and upload it, I then get a server 500 error from my site.
posted by You Should See the Other Guy at 7:57 PM on May 25, 2006


www.mydomain.com/index.php/template/

According to this page in the EE wiki, I can configure .htaccess to omit the index.php so it looks like this

www.mydomain.com/template/
Are you looking to access www.mydomain.com/index.php/template/ or www.mydomain.com/template/index.php/?

If the latter, you could just add the following line to your .htaccess:

DirectoryIndex index.php
posted by Doofus Magoo at 8:04 PM on May 25, 2006


Response by poster: Doofus, EE adds /index.php after the domain name. Doing what you suggest would render as www.mydomain.com/index.php/template/index.php/

I want to get rid of the first index.php
posted by You Should See the Other Guy at 8:08 PM on May 25, 2006


A 500 error that shows up after you add .htaccess files generally means the redirect is sending the server in an endless loop. Do the wiki instructions say where you should put the .htaccess file? I think maybe you need to create a directory named "template" and put the .htaccess file in there if you want the address to be domain.com/template/.
posted by scottreynen at 8:16 PM on May 25, 2006


Meta hint: you might want to change your .htaccess tag to htaccess because the .htaccess tag returns a 403 when browsing the tag.
posted by Mitheral at 8:21 PM on May 25, 2006


Response by poster: It doesn't specify. However, there are multiple templates not just one.
posted by You Should See the Other Guy at 8:23 PM on May 25, 2006


Response by poster: Does the htaccess file have to have certain permissions set?
posted by You Should See the Other Guy at 8:24 PM on May 25, 2006


Can't recall where I spotted this today, but here is a .htaccess file generator: http://cooletips.de/htaccess/
posted by boost ventilator at 8:28 PM on May 25, 2006


Response by poster: Thanks, all! Got it working!

(textedit was doing something to the file. I opened it in the ftp program and it looked all screwy. rewrote it in there, uploaded, worked!)
posted by You Should See the Other Guy at 9:01 PM on May 25, 2006


In the future you probably just need to make sure that you save the file in plain text (not RTF or Word format), and that the FTP program is transferring in ASCII mode, not binary or auto-detect.
posted by team lowkey at 2:14 AM on May 26, 2006


« Older Amp & speaker recommendations for outdoor...   |   Clamback! The Worst Elvis Movie Never Made Newer »
This thread is closed to new comments.