views:

44

answers:

2

Hi

Please review my .htaccess code below. The code below was suggested by I User here (Thanks for the code Gumbo), And I can't seem to make it work.

RewriteCond %{THE_REQUEST} ^[A-Z]+\ /myadmin[/\s] [NC]
RewriteRule ^myadmin - [NC,L,R=404]

RewriteCond %{HTTP_HOST} =myadmin.movietunie.com [NC]
RewriteRule !^myadmin/ /home/movietun/public_html/movie_tunie/myadmin/%{REQUEST_URI} [L]

What I want to happen, In my domain (www.movietunie.com) I have a folder named (myadmin) and can be access by going to (www.movietunie.com/myadmin). Now there are a lot of user keep accessing that folder. I want to minimize it by changing the structure of it.

I want (myadmin) to be access in a subdomain structure instead of '/' so it would be something like this (myadmin.movietunie.com), Now when the try to access (www.movietunie.com/myadmin) from a browser they will get an error, But the folder structure will still remain.

Hope this make sense

Thank You!

A: 

Something like this should work:

RewriteRule ^myadmin - [NC,L,R=404]

RewriteCond %{HTTP_HOST} myadmin.movietunie.com [NC]
RewriteRule ^(.*)$ /myadmin/$1 [L]
Greg
Hi Greg,I updated my .htaccess and still can access my http://movietunie.com/myadmin/, Is there anything I should do aside from uploading my .htaccess?Thanks!
Pennf0lio
+1  A: 

Why don't you set up two virtual hosts for this purpose? Something like

Listen 80
NameVirtualHost *:80

<VirtualHost *:80>
  ServerName www.movietunie.com
  ServerAlias movietunie.com
  DocumentRoot /home/movietun/public_html/movie_tunie/

  Redirect 301 /myadmin* http://myadmin.movietunie.com
</VirtualHost>

<VirtualHost *:80>
  ServerName myadmin.movietunie.com
  DocumentRoot /home/movietun/public_html/movie_tunie/myadmin/
</VirtualHost>
Zed
Thanks for the advice Zed,But I don't know how it works and how can I implement it, Should I buy another server for that?Thanks!
Pennf0lio
Added a tiny example of what your site's config file should look like.
Zed
I'll create httpd.conf for this right? in my /etc/httpd/conf/. Thanks for your advice!
Pennf0lio
Umm, yes; but there should be other settings in your conf file, so be careful what you replace.
Zed
I still can access movietunie.com/myadmin. So here's what i've done in my (/etc) I created a folder (/httpd) and under it I created another folder of (/conf) and put httpd.conf containing only your code. I've notice in my (/etc) folder I got folders and they are named with my domains, Is that normal? I'm using shared hosting.
Pennf0lio
You should really read some docs on how Apache is configured in general.
Zed
Okay thanks Zed!
Pennf0lio