Jump to content


Photo

.htaccess mod_rewrite issues


  • Please log in to reply
3 replies to this topic

#1 Terminator3d

Terminator3d
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 26 August 2006 - 12:02 PM

Hi guys im new here so please be nice  :P

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:
http://www.mysite.co...&order=1&page=1

And im after something like:
http://www.mysite.com/view/all/1/1

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.

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 26 August 2006 - 01:58 PM

Mod_write will not rewrite the URLs for your links. So you'll have to rewrite the links in your code to the new format manually.

mod_rewrite runs when a page request is made to to the server. It then sees if the url matches one of the rewritre rules, if it does it'll process the url in the rewrite rule.

#3 Terminator3d

Terminator3d
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 26 August 2006 - 07:24 PM

Ive now altered the links into a format like:
http://www.mysite.co...w_value/all/1/1

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?

Thanks

#4 invincible_virus

invincible_virus
  • Members
  • PipPip
  • Member
  • 27 posts
  • LocationDelhi, India

Posted 03 September 2006 - 02:25 PM


OK, I got this info from some articles on net, it didn't work for me.
you can give a try.
Make sure that mod_rewrite module is loaded on your apache server, to do this uncomment following lines in httpd.conf -
1. LoadModule rewrite_module modules/mod_rewrite.so
2. ClearModuleList
3. AddModule mod_rewrite.c


PG accommodations in India - http://www.pgspace.com/
Technical Forum - http://www.enterpriseplatform.net/




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users