1

Lets say we have a URL that looks like this: http://www.onegreatwebadress.com/index.php?sideID=home and we want it to show something like this instead: http://www.onegreatwebadress.com/home

How is it done with mod_rewrite -> apache 2.2?

Here is my .htaccess (placed in the root file of the webserver) : Additionaly, the website im working in is placed in a sub dir: www\onegreatsite

RewriteEngine on
RewriteBase /onegreatwwebadress/
RewriteRule ^sideID([a-zA-Z0-9]+).php$ sideID.php?=$1

1
  • Which previous example? Can you show us what you are doing? It's very hard to simply guess why it's not working for you.
    – Steve
    Apr 1, 2013 at 21:52

2 Answers 2

0

This is done by uploading a file called: .htaccess to your web directory. Apache will read this, and will allow you to manipulate your URL, amongst other things.

A website I have found useful for performing actions and also informative for new users:

http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html

Examples published on this page will help solve your situation.

4
  • yeh, that is exactly how I do it. But for some reason it wont work, I guess I just have to keep trying. Apr 1, 2013 at 22:01
  • Then can you display the contents of your .htaccess
    – Daryl Gill
    Apr 1, 2013 at 22:02
  • Update it in your question with correct formatting
    – Daryl Gill
    Apr 1, 2013 at 22:07
  • Oh, ofc.. pardon me. Here we go ;) Apr 1, 2013 at 22:18
0

It seems like your .htaccess is not functioning properly. This could be fixed by changing the Apache configuration. Often these kind of .htaccess problems can be fixed by adding AllowOverride all to the <Directory> section in the Apache configuration file. Here is an example.

<Directory /var/www/>
   AllowOverride all
</Directory>

This will allow the .htaccess file to override any previous stated configurations.

Not the answer you're looking for? Browse other questions tagged or ask your own question.