terminology httpd conf question

dmacleo

Verified User
Joined
Jun 21, 2012
Messages
631
I want to get rid of htaccess used only for rewrite on one domain on server.
can this be done in the custom httpd.conf as described here
http://help.directadmin.com/item.php?id=3

or is this something I have to do in the main apache conf file.
I looked at this and at the custom virtual hosts knowledge base articles but neither really seemed to answer my question, and that may be due me not knowing how to phrase the question best.
the htaccess code I want to just add to apache is:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} .*\.(jpeg|jpg|gif|png)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /public/404.php [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
this is the code IP Board uses for FURLS for SEO.
 
yeah I did and seems to work, just not sure thats the best way.
it would seem to me if there was a way to do it w/o editing main httpd.conf that would be safer.
 
getting rid of it as I may be using nginx, also everything I read says its more effecient to do this stuff in conf file.
I had wondered if inserting code there would work, will try that out this weekend.
 
yeah think I misunderstood the reply.
so to simplify..
if I insert that rewrite code in the custom section will it work?

had considered trying it to see but did not have time to mess around so right now I just used main httpd conf file.
 
@Jeff

Did you mean no other way?

Yes, that's exactly.


@dmacleo,

if I insert that rewrite code in the custom section will it work?

You might need to use mod_rewrite rules within Directory Context

Related http://httpd.apache.org/docs/current/mod/mod_rewrite.html

So it would be something

Code:
<Directory |DOCROOT|>

  # add here your rules

</Directory>

|DOCROOT| - is a token, which will be replaced by Directadmin with an actual document root for the virtual host.
 
ok thanks, I did use directory path when doing it in the main httpd.conf. so the token doing it for me will help in future usage
sometime today I will cut that out of main, paste into the custom, restart httpd and see how it goes.

thanks all.
 
Back
Top