Jump to content

Help with simple rewrite


Andy-H

Recommended Posts

Can anyone help me with this, I am writing a website locally (WAMP) for my Dads decorating company and wish to rewrite the URLs to eliminate query strings,

 

I have a folder in www called DadSite and am working off the .htaccess file in that folder (I have already loaded the rewrite module in apache and restarted all services)

 

I wish to rewrite http://localhost/DadSite/index.php?page=(.*)

 

to http://localhost/DadSite/$1

 

I.e

A request to

http://localhost/DadSite/Home

 

will point to

 

http://localhost/DadSite/index.php?page=Home

 

But havent really used mod reqrite and wish for it to work when I transfer the site to a live server (probably shared host) in which the domain and public directory will be different.

 

I have tried many variants but still cant get it to work.

 

Options +FollowSymLinks

RewriteEngine On
RewriteRule index.php?page=(.*)$ $1  [NC,L]

 

Thats my latest attempt, which resulted in failure lol

 

Any help appreciated!

Link to comment
Share on other sites

I don't follow you.  The goal of "search engine friendly" url rewriting is to take a parameterized real url like:

 

http://mysite.com/index.php?page=home and allow someone to instead use http://mysite.com/home/.

 

In that case the rewrite rule will parse the last part of the url and turn that into the parameter to page=.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.