Jump to content

sammydafish

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Contact Methods

  • AIM
    amoredis

Profile Information

  • Gender
    Not Telling
  • Location
    Need deep in mod_rewrite hell

sammydafish's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks man. This is what ended up workin for me: RewriteEngine On RewriteRule ^(inventory/?.*) - [L] RewriteRule ^([^.]+)$ index.php?page=$1 [L] There might be a better way to do it, but after much trial and error, this is working. The 1st one just checks for the inventory possability, and sends the user there. The other will run the script. This rule will also let me link to other files in the file system as long as I call them with extentions. i.e someotherfile.php will work. not rewrite to index.php?page=someotherfile.php Took me a while to figure out how to do that. The thing that helped me the most was simple to know ot look for info on regular expression. I found htis document http://www.amk.ca/python/howto/regex/ that helped me a LOT! One thing I couldn\'t figure out, what\'s the [L] or [NC] mean? Thanks for your help!!
  2. BTW, forgot to mention, Apache 2.0.45 on Win2K Thanks
  3. I\'m putting up a CMS system that I just finnished. I want to use mod_rewrite to handle get variables to my main script. I\'ve tried a few examples, but I can\'t seem to get this to work properly. What I\'d like to do is have: www.mydomain.com/index.php?page=products be displayed as www.mydomain.com/products I used this in my httpd.conf file: RewriteEngine on RewriteRule /([a-z]+) /index.php?page=$1 and I was able to get it working for a little bit. I put in in the <directory> directive. I tried to put it in the .htaccess file, but it did nothing when I did. Basicaly, I have a few questions. One, how come it doesn\'t seem to work when I put it in the .htaccess file. Two, how can I write a rule that will check to see if the request actualy exists in the file system, if so, serve the actual file, not rewrite it. Example: within the document root, there is a path \'inventory\' so when www.mydomain.com/inventory is requested, I want to serve up the default document in the directory, not index.php?inventory. How? Is there a good document that explains all the things used to write a rewrite rule? I\'m confused by the use of carrots and parens and brackets and what not. I read teh apache documentation, but it was not easy to understand :roll:, hence, I\'m here asking. I read the article: http://www.phpfreaks.com/tutorials/23/0.php It wasn\'t really much help. Also, what\'s the best place to put rewrite rules, and what <directory > options or permissions need to be on in order to use it? Thanks lost :arrow: - Anthony
  4. whoah there.... no need for the whole file, you only need to change a little bit. Basicaly, uncomment the virtual hosts section at the end, and change to what you need. All you need is a few lines: NameVirtualHost * # turns on name bassed virtual hosting for all IPs on the system #define a virtual site ... we\'ll start with the default site <VirtualHost *> DocumentRoot E:htdocsdefaultsite # document root for the site ServerName yoursite.com # if the site is accessed with this name, display this site ServerName www.yoursite.com # we\'ll display the site if we get here this way too </VirtualHost> # now we\'ll define a site on a sub domain <VirtualHost *> DocumentRoot E:htdocssubdomainsite # document root for the site ServerName sub.yoursite.com # if the site is accessed with this name, display this site </VirtualHost> thst\'s it... easy as pie requests that come in on the IP address only will be served by the 1st VirtualHost listing. HTH
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.