I'm trying to make an ajax call from within a page with a rewritten URL.
request = $.ajax({
url: "myajaxcode.php",
type: "post",
data: formData
});
The resulting request is .../Folder/Rewritten_Name/myajaxcode.php
For this to work the url should be .../Folder/myajaxcode.php
I also tried using a backslash in the url: "/myajaxcode.php", this resolves to
/myajaxcode.php
The ajax works when I provide the absolute URL or if I use a function that calculates and base URL and prefixes it the php file name. However, ideally I wanted to avoid using absolute urls or additional functions.
Is there a better way of handling the ajax call?
My htaccess is
RewriteEngine on
RewriteBase /Folder/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^Rewritten_Name/([^/]+) Rewritten_Name.php?r=$1