Jump to content

mod_rewrite doing my head in


glenelkins

Recommended Posts

Hi

 

I have a script that uses index.php like this: index.php?section=sectionname&page=pagename

 

I have a .htaccess file like this:

 

RewriteRule ^([a-z0-9]+)/*$ index.php?section=$1 [L]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)$ index.php?section=$1&page=$2 [L]

 

Which rewrites the urls to /section  or /section/page

 

Now i have a javascript file that is calling a file with ajax called "ajax.php". I use GET to call 'application/Functions/ajax.php' . The application folder sits on the same level as the index.php file and the ajax returns this:

 

The requested URL /cms/home/application/Functions/ajax.php was not found on this server.

 

to me that looks like because im currently in the /home section  its trying to find the application folder in /home/ rather than from the root which would be /cms/

 

I assume there is an additional rewrite rule required, but when i try the following it still does the same:

 

RewriteRule ^[a-z0-9]+/application/Functions/([a-z0-9]+)$ application/Functions/$1 [L]

Link to comment
https://forums.phpfreaks.com/topic/159835-mod_rewrite-doing-my-head-in/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.