Kenneth Vogt
Kenneth Vogt

Reputation: 995

How can I simplify my url with .htaccess?

I would like this:

http://www.website.com/test/view

to actually call this:

http://www.website.com/index.php/test/view

I tried an .htaccess file that looks like this but it doesn't seem to work:

RewriteEngine on
RewriteCond $1 !^index\.php
RewriteRule ^(.*)$ /index.php/$1 [L]

What am I missing?

Upvotes: 0

Views: 227

Answers (2)

Spons
Spons

Reputation: 1591

Did you set "RewriteEngine On" At The first line??

I used this once and it worked fine for me:

RewriteEngine On
RewriteRule ^([a-z\-]+)$ /index.php?page=$1 [L]

Upvotes: 1

anubhava
anubhava

Reputation: 785266

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^ index.php%{REQUEST_URI} [L]

Upvotes: 1

Related Questions