View Full Version : .htaccess mod_rewrite issues

08-26-2006, 02:13 PM
Hi guys im new here so please be nice :)

Ok im having some problems with understanding how htaccess files work with php. Ive written a site in php which uses dynamic content so I want to rewrite the querystrings.

As it stands within the php code ive written it so the URLs are outputted with the format:

And im after something like:

Do I need to modify the format I output these URLs within the php....or does the htaccess file do everything?

As it stands ive got:

Options +FollowSymLinks
RewriteEngine on
RewriteRule view/(.*)/(.*)/(.*)/$ view.php?tn=$1&order=$2&page=$3

Can anyone help me out with this please? Ive been trying to get this working a while and arent sure what im doing wrong. Everything I try either doesnt work or gets a server error.

Thanks in advance.

08-26-2006, 03:16 PM

Options +FollowSymLinks
RewriteEngine on
RewriteRule view/(.*)/(.*)/(.*)/(.*)/(.*)/(.*)/$ /view.php?$1=$2&$3=$4&$5=$6

will output


Got this from


but you can try editing it.

If you want it the way you stated I think you can use this:

Options +FollowSymLinks
RewriteEngine on
RewriteRule view/(.*)/(.*)/(.*)/$ /view.php?tn=$1&order=$2&page=$3

which means your links will be:


i think :)

08-26-2006, 03:37 PM
Thanks for the help but I think it may have something to do with my php opposed to the htaccess....obviously im a newbie to this so stop me if im wrong.

Say for example I create a hyperlink and echo out the querystring like below, will the htaccess rewriting of querystrings work?

<a href="<?php echo "view_values.php?tn=all&amp;order=$order&amp;page=1"; ?>">All</a>

I cant work out where Im going wrong at all. Any help appreciated greatly....its driving me crazy. Im told the server has been configured for htaccess and mod_rewrite so dont think the problem lies there.


08-26-2006, 03:42 PM
ah sorry i didnt read your post properly, no im pretty sure that you hae to create the links yourself in php. Before you mess everything up id suggest you make it a chooseable option via mysql si you can do:

$usemodrewrite = "yes";
if ($usemodrewrite == "yes") {

$link = "http://www.mysite.com/view/tn/all/order/1/page/1/";

} else {

$link = "http://www.mysite.com/view.php?tn=all&order=1&page=1";


08-26-2006, 09:16 PM
This is just too much fun. Ive now altered the links into a format like:

Now Im getting the following 404 error:

The requested URL /view_value/all/1/1 was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

My htaccess file looks like:

Options +FollowSymLinks
RewriteEngine on
RewriteRule view_value/(.*)/(.*)/(.*)/$ /view_value.php?tn=$1&order=$2&page=$3

Any ideas where im going wrong at all?


08-27-2006, 12:19 AM
Thanks for the help Anthony Ive solved it now.


08-27-2006, 01:41 PM
can you post what it was ?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum