[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Using mod_rewrite

Posted on 2008-10-02
2
Medium Priority
?
589 Views
Last Modified: 2013-11-10
I need help setting up mod_rewrite rules

I have the following file structure:

http://www.domain.com/index.php
http://www.domain.com/schools.php
http://www.domain.com/business.php
http://www.domain.com/contact.php

i would like it to appear as:

http://www.domain.com/
http://www.domain.com/schools/
http://www.domain.com/business/
http://www.domain.com/contact/

so thats it's all nice and clean, but i am having trouble figuring out the re_write rules :(
0
Comment
Question by:carlsilver
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 27

Accepted Solution

by:
caterham_www earned 2000 total points
ID: 22622468
Did you already modify your html source code so that you've a link like 'a href="/schools/"''? Because mod_rewrite cannot modify the html source code but only rewrite or redirect incoming requests.

You have two options in order to direct requests like /schools/ to its corresponding php file:
Option one w/o mod_rewrite
 
DirectoryIndex index.php
Options +MultiViews
 
Option two:
DirectoryIndex index.php
RewriteEngine on
# if you don't call existing folders like /existent/, remove the condition
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/.]+)/?$ /$1.php [L]

Open in new window

0
 

Author Closing Comment

by:carlsilver
ID: 31502300
I couldnt get the mod_rewrite working, but Options +MultiViews works perfect! Many thanks! :D
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These instructions are based on installing Owncloud on your new raspberry pi connected with a usb HDD. What do you need Part A? A Raspberry Pi, model B. A boot SD card for the Raspberry Pi. A usb HDD An Ethernet cable to connect to the lo…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question