Jump to content


Mod_Rewrite Question


5 replies to this topic

#1 Empresive

    Young Padawan

  • Members
  • Pip
  • 10 posts

Posted 03 January 2009 - 12:18 PM

Hi,

Can anyone one help me out with mod_rewrite on how to change it so everypage doesnt go to mysite.com.

I have mysite.com/index.php?page=test with mod_rewrite to change it to mysite.com/page/test.html but loads mysite.com instead of the page.

What could cause the pages to load mysite.com instead? can AuthName mysite.com in the htaccess file do cause this?

Edited by Empresive, 03 January 2009 - 12:22 PM.


#2 Pr0oF

    Young Padawan

  • Members
  • Pip
  • 19 posts

Posted 03 January 2009 - 12:39 PM

RewriteEngine On
RewriteRule ^page/([^/]*)\.html$ test.php?page=$1 [L]


#3 Empresive

    Young Padawan

  • Members
  • Pip
  • 10 posts

Posted 03 January 2009 - 02:11 PM

Thank's :(

#4 Empresive

    Young Padawan

  • Members
  • Pip
  • 10 posts

Posted 08 January 2009 - 09:29 PM

Does mod_rewrite work with php? cause i have php code at the top of my page but then mod_rewrite stops working if i remove the php code it starts working again.

This php code....

Quote

<?php
$curdir = getcwd ();
chdir('/path/to/your/dir/');
require_once('/path/to/your/dir/somthing.php);
chdir ($curdir);
?>

inerferes with mod_rewrite and dont know why, anyone know how i can fix this?

#5 rc69

    PHP Master PD

  • P2L Staff
  • PipPipPipPip
  • 3,827 posts
  • Gender:Male
  • Location:Here
  • Interests:Web Development

Posted 09 January 2009 - 01:03 PM

mod_rewrite and php are two separate systems. The two do not interact with each other. If that code "stops mod_rewrite from working" then it is most likely a problem with the php that is causing an error that appears to be breaking mod_rewrite. Could you give us more information on the problem?

Random question: What purpose is the code you provided supposed to serve? I ask because it appears redundant to me. There is no need to chdir() to a specific directory when your require statement has the full path to the directory your changing to (unless something in that file requires more from the directory its in; in which case it would be best to put the call to chdir() inside the file you're requiring).

#6 Empresive

    Young Padawan

  • Members
  • Pip
  • 10 posts

Posted 09 January 2009 - 02:55 PM

The code is for an external login to my forum from my site. Just when that code is added to the same page as my php navigation it stops working. If i removed the code from the top of my page the my navigation starts working again, so its somthing to do with the php code for my external login but i just dont know what and been playing with it and just cant seem to figure it out yet.

Edited by Empresive, 09 January 2009 - 03:28 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users