Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] [OT] Creating user-friendly URLS with mod_rewrite/Apache



Godwin, Romans,

Thank you for your help and advice.

I think I must be missing some small detail here, as it is still not working. I checked my syntax against the Apache.org web site, and made some small adjustments, but still without success.

If it's not too much trouble, could someone review these steps and tell me where I might have gone wrong?

I have this in my /etc/apache2/httpd.conf file:
<Directory /var/www>
AllowOverride All
</Directory>

I believe that /var/www is my document root. And according to this web page, the AllowOverride should specify "All".
http://httpd.apache.org/docs/2.0/mod/core.html#allowoverride

My index file is here:
/var/www/web_sites/testsite.com/web/index.php

So I put my .htaccess file in the same directory:
var/www/web_sites/testsite.com/web/.htaccess

In my .htaccess file, it says:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php

However, I also tried this instead:
RewriteEngine on
RewriteRule     ^(main.php.*)$           $1                  [L]
RewriteRule     ^([^\./]*(&.*)?)$        main.php?page=$1    [L]

However, neither syntax work.

When I put a link inside index.php that says <a href="page">page</a>, and I click on the link, I expect it should go back to index.php, which has code for taking "page" out of $_SERVER['PATH_INFO'] and displaying the right web page data.

However, when I click the link, it says:
NOT FOUND
The requested URL /web_sites/thinkingworks.com/web/page was not found on this server.


With the httpd.conf and .htaccess I have, shouldn't it have not found any directory called "page", then opened index.php?

--
Dave M G


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links