Rewriting a URL with mod_rewrite
I'm trying to do a simple URL rewrite of a URL to pass it through a script but the .htaccess I've written doesn't work.
I'm trying to rewrite something like this: http://sub.domain.com/result.xml so that the server sees: http://sub.domain.com/script.php/result.xml so that when someone asks for result.xml it goes through a parsing script (script.php) first. What I've got so far from my Google searching is this: Code:
Options +FollowSymlinks |
Hi,
Try this: Code:
Options +FollowSymlinks |
I think PlymWS rule gets into an infinite rewrite loop (/script.php/script.php/script.php/.../result.xml).
bathory's result should work well for .xml files in the root, but it will not redirect say /something/result.xml to /script.php/something/result.xml. I think it is equivalent to Code:
Options +FollowSymlinks Code:
Options +FollowSymlinks |
Thanks to both for your replies. I have tried both and they both 404 on sub directories. Looking at the web console in FF it seems that a subdirectory xml isn't rewritten.
The requested URL /sub1/result.xml was not found on this server. when trying to rewrite http://sub.domain.com/dir/result.xml to http://sub.domain.com/script.php/dir/result.xml |
Quote:
Code:
RewriteEngine on |
Yeah, sorry subdirectories was an after thought. Anyway all working. Many thanks.
|
Hi All,
I got a multi-site/multi-vhost webserver with apache2 + drupal7 and squeeze. Everything is running fine but I want to redirect all root domain requests to the www vhost from the apache config files instead of .htaccess. That is where I got stuck as all the examples I found were doing it in the .htaccess and they use RewriteCond. Since the requested URL is already known in the corresponding vhost's section further search would be unnecessary therefore I've commented out the condition. It doesn't work either way. Do I need to trigger a true condition before going to the RewriteRule or is that true by default? If so how to do that? This is how I tried: Code:
<VirtualHost example.com:80> Regards Tony |
Hi,
Quote:
BTW, next time please don't hijack others threads. Start you own thread, so it gets the attention it deserves Regards |
Hi Bathory, thanks for the response.
Quote:
The rewrite module is installed and works perfectly with all the drupal sites, they all use clean URLs. Quote:
|
Quote:
So please do so, posting distro, apache config files (especially the vhosts), so we can try to find what's wrong. Regards |
All times are GMT -5. The time now is 02:37 PM. |