Apache URL Rewrite

Posted by sgtbeano on Pro Webmasters See other posts from Pro Webmasters or by sgtbeano
Published on 2012-09-06T13:48:49Z Indexed on 2012/09/10 15:50 UTC
Read the original article Hit count: 387

Filed under:
|
|
|

I'm trying and failing to get a URL rewrite working, firstly I'm doing it in the vhost declaration, is that right?

What I'm trying to do is take any URL which has;

view.php?id=[a 1 or multidigit number]

and rewrite it to

view.php?id=[number]&section=1

Any help would be greatly appreciated, thanks for looking.

Okay, so I tried the suggestion below (thanks for that) and now have this in my vhost file but still no effect;

NameVirtualHost *:80

<VirtualHost *:80>
    ServerAdmin ########
    DocumentRoot "########"
    ServerName ########
    ErrorLog "logs\########.log
        <Directory "########">
            DirectoryIndex index.php index.html
            AcceptPathInfo on
            Order allow,deny
            Allow from All
        </Directory>
        <Location />
            RewriteEngine on
            RewriteRule ^/view.php?id=([0-9]*)$ /view.php?id=$1&section=1 [R]
        </Location>
</VirtualHost>

Any more suggestions?

Thanks again

© Pro Webmasters or respective owner

Related posts about apache

Related posts about htaccess