Forum Moderators: phranque

Message Too Old, No Replies

rewrite doesn't work, why?

         

bbbandit

3:36 pm on Oct 19, 2006 (gmt 0)

10+ Year Member



Hi

I cant get this rewrite going, i did rewrite for my ecommerce and forum site, but now i only want to rewrite one file and dont work!

I add this at my .htaccess file:


RewriteRule ^forum/sitemap.xml$ /forum/sitemap.php [L]
RewriteRule ^forum/forum-([0-9]+).xml$ /forum/sitemap.php?fid=$1 [L]

The file isnt the root, its at forum directory, i try different tactics, but my im very basic with rewrite, can some have a look, if i get error with the command?

Apreciate your time

jdMorgan

1:07 am on Oct 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Where in your site directories is this .htaccess file located?

Did you include


Options +FollowSymLinks
RewriteEngine on

before your mod_rewrite code?

If you get a erver error, check your server access log and your server error log. The information in those files will often identify the problem.

Jim

bbbandit

2:40 pm on Oct 20, 2006 (gmt 0)

10+ Year Member



First of all, thanks for your reply.

Where in your site directories is this .htaccess file located?

My .htaccess file is located in the root:
www.mydomain.com

I have the file that i want to rewrite in the forum directorie:
www.mydomain.com/forum/sitemap.php

Did you include

Options +FollowSymLinks
RewriteEngine on

before your mod_rewrite code?

Yes i did

If you get a erver error, check your server access log and your server error log. The information in those files will often identify the problem.

I dont get a server error, only i cant get my php file rewrite to .xml

jdMorgan

2:53 pm on Oct 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Files cannot be rewritten to URLs, URLs are rewritten to existing files.

Your code should work if your pages link to .xml URLs, and corresponding .php files exist.

mod_rewrite acts in the URL-to-file translation phase of the Apache API, and can change the default URL-to-filename mapping. It acts after a URL is requested from your server, but before any content-handlers are invoked to output page content and before any scripts are executed. It does not change the links on your pages.

Hopefully it's not that misunderstanding that is the cause of your trouble.

Jim

bbbandit

3:27 pm on Oct 20, 2006 (gmt 0)

10+ Year Member



Thanks again for your help, i give up on this rewrite and i try another one, and it work i cant explain why, but make the trick.

g1smd

1:01 am on Oct 22, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What was the new code that you used?

bbbandit

8:11 am on Oct 23, 2006 (gmt 0)

10+ Year Member



Options +FollowSymLinks
RewriteEngine On
RewriteBase /

RewriteRule ^forum/sitemaps.xml$ /forum/sitemap.php [L]
RewriteRule ^forum/forum-sitemap-([0-9]+).xml$ /forum/sitemap.php?fid=$1 [L]