homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

mod_rewrite "emergency"
dmoz directory "typo" is going to non-existing folder

 4:18 pm on Jan 13, 2003 (gmt 0)
Normally I would sit down and make this a learning project
but its a bit of an emergency so I need someone's expertise

I just noticed a site I am responsible for got into DMOZ but its got the wrong URL -
pointing to a non-exisiting folder without any file name! (sheesh DMOZ editors)

this code doesn't work to fix it, any pointers?

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.Ķ )\.mydomain\.com/blah$
RewriteRule ^(.*)$ http://www\.mydomain\.com/new-blah\.htm$1 [L]



 4:23 pm on Jan 13, 2003 (gmt 0)

Try this...


Might be some help.


 4:37 pm on Jan 13, 2003 (gmt 0)

If you don't have time for the learning curve, why not just create the directory and file?


 4:44 pm on Jan 13, 2003 (gmt 0)

%{HTTP_HOST} contains only the host that should handle the request, i.e. www.domain.tld or domain.tld or whatever. Unless there is somethink tricky going on like using mod_rewrite to handle subdomains you usually do not need to test for that. Rewriting takes place after Apache has determined which host/virtual host should handle the request.

The syntax for the RewriteRule is RewriteRule re-matching-URI-path rewritten-URI.

There is no need to escape dots in the rewritten-URI part since it is not a regular expression, i.e. the dot has no special meaning.

If the link is DMOZ is [domain.tld...] and you want it rewritten to [domain.tld...] then your RewriteRule would need to look something like this.

RewriteRule ^aaron/$ [domain.tld...]  [L,R=301]

You could use the much simpler Redirect [httpd.apache.org]Permanent as well:

RedirectPermanent /aaron [domain.tld ]

Please read An Introduction to Redirecting URLs on an Apache Server [webmasterworld.com] by DaveAtIFG if you havenīt done so yet. We are generally ask not to supply code like this. I made an exception this time. But please be sure to read the introduction and study the mod_rewrite docs. Testing and playing around on a local server will help a lot. Apache is very easy to set up on almost all operating systems.



 6:23 pm on Jan 13, 2003 (gmt 0)

Thank you for the help. It's working perfectly now.

I promise by the end of the day to have read all the
mod_rewrite stuff so I don't re-hash easier stuff like this.
I've got a whole new bookmark folder for mod_rewrite
now and will be reading and practicing shortly :)

Been meaning to do that for awhile now but you know
how little projects get pushed aside when bills have
to be paid. But mod_rewrite is one super serious tool
and I just need to make it a priority to master it.

Thanks again! (what are we up to, 3 pints of cider? :) )


 10:45 pm on Jan 13, 2003 (gmt 0)

You are welcome amznVibe. I figured the rule against posting specific rules applied only when answering posts of people who otherwise do not contribute to WebmasterWorld.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved