# [web] URL Rewrite, The complexities of a beautiful feature

## Recommended Posts

I'm trying to get Apache's URL rewrite working on my server and can't seem to get a grasp on the problem. Here's what I've got, which I'm sure isn't right:
<IfModule mod_rewrite.c>
RewriteEngine On

RewriteLog "/var/www/rewrite.log"
RewriteRule ^(.*)$index.php?m=$1 [L,QSA]
</IfModule>
I want to redirect anything after / through index.php. My internal code will automatically determine what page will be shown. Well, this isn't working. I get a 404 error. Any help would be great :)

##### Share on other sites
actually, now that I've tried something else, my URLs throughout the site could get screwed up... Just about every link has a url like this:

?m=blah&id=10

Having a url like: http://whatever.com/home will force the above link to go here:

http://whatever.com/home/?m=blah&id=10

Which isn't right. So maybe URL rewrite isn't what I want. How about a url redirect of sorts?

##### Share on other sites
I think you just want to set a handler in the root directory.

##### Share on other sites
Quote:
 Original post by OluseyiI think you just want to set a handler in the root directory.

Thanks, I'll try this out.

##### Share on other sites
Oluseyi, thanks for the reply, but that doesn't appear to perform what I'm looking for. I've now flip-flopped. I do need to use URL Rewrite. My URLs don't have / in front of them, so adding them will fix the path issue. The issue I'm having now is that I'm trying to test a known working URL rewrite method on my Ubuntu server, but it's not working. URL Rewrite is installed and as far as I can tell, should be working. Unfortunately, checking the logs won't do me any good because they aren't being written to.

Any ideas?

Edit: I'm being hasty today. I found some info on the Ubuntu forums and will be doing more testing. If I have further issues, after having exhausted my resources, I'll come back.

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
627746
• Total Posts
2978906

• 10
• 10
• 21
• 14
• 14