last day (15 days later) » 

4:20 PM
0
Q: What has priority? A 'system' link or my website?

William David EdwardsI have cPanel and clients can access it via mydomain.com/cpanel, but I don't want them to. So I configured in my .htaccess that mydomain.com/cpanel should be redirected to mydomain.com/somethingElse but it still redirects me. Is this because mydomain.com/cpanel is a 'system link'?

 
What do you mean by it still redirects me? Does the redirect in your .htaccess work?
 
@NuTTyX it still redirects me = /cpanel redirects me to cPanel.
 
Where do you have your .htaccess? It should be on the cpanel folder or it's parents. Being a symbolic link could break inheritance, since apache searchs for those files from the current folder (the document that is being served) to the root folder.
 
@NuTTyX I don't have access to the cpanel directory, hence why I'm trying to do it via .htaccess in the public_html folder of a VirtualHost.
 
Could you please show what you can and what you cannot do? (Edit apache's config files, create/delete/rename files on DocumentRoot and cpanel directory, etc) Also, it would be nice if you posted your .htaccess with you have tried so far.
 
4:20 PM
@NuTTyX I don't have access to any system files/folders. My .htaccess is functional, it's just a basic working 301 redirect.
 
Could you post your .htaccess? May be you have missed something.
 
@NuTTyX Maybe we should continue this in chat.
 
OK
 
Hi
 
4:21 PM
OK... so as you probably already understood, I am on a server with cPanel installed. I am not able to manage the system though, so I can't change system files/folders.
Clients of mine, hosted on that server, can use www.mydomain.com/cpanel
I don't want them to.
 
The thing with .htaccess is that if you try to use RewriteRule, you might get stuck with folders, and probably (didn't test myself) won't work with symlynks
 
Exactly, that's what I thought too.
 
so if you are using RewriteRule to do the redirect, you might not get it working...
 
I am using a simple 301 redirect at the moment, could you elaborate a bit more further on the RewriteRule?
 
could you please post any mod_rewrite rules that apply?
I mean: do you use RewriteBase?
or RewriteCond ?
 
4:23 PM
Just a simple redirect (Redirect 301 cpanel site)
 
RewriteConf /cpanel(.*) /someotherplace/$1 [R=301]
??
 
No, exactly like I said
 
Redirect is not from mod_rewrite, is from mod_alias
 
that COULD work better than mod_rewrite, actually
 
4:25 PM
K.
 
But you missed the /
 
That was just an example ^
What I'm actually using is Redirect 301 /cpanel http://domain.com
 
Redirect /cpanel /site
and it doesn't work?
 
that's ... unexpected
 
4:27 PM
Haha.
 
give me a few minutes
 
OK. I really appreciate the help btw.
 
ok, I have tested myself on a apache2.2
Redirect DOES work
Do you have shell access to the server?
ps -ef | grep http
to check whole path to http binary
Check version with /path/to/binary -v
just to make sure
do you have read access to the config files on apache?
just read, to check if you are allowed to use .htaccess
grep -r -e Directory -e Location -e AllowOverride /path/to/apache/config/files
if there is any "None" that could explain why your .htaccess does not work
Actually, if there is not an AllowOverride All or FileInfo, Redirect won't work on that Directory
 
5:09 PM
Sorry for the late response (dinner)
I can request SSH access.
The output is.
x 568487 567579 0 18:15 pts/0 00:00:00 grep http
 
no http proccess? may be with ps -ef | grep apache ?
seems that you are not allowed to use .htaccess files
 
I am allowed to use .htaccess files, I have more in my .htaccess and it's functional
... grep apache just shows the same as above but it replaces http with apache
 
assuming domain.com as your domain
 
would show a file at the same level as your .htacces is?
 
5:21 PM
Yep..
 
and cpanel is a symlink on that folder too, isn't it?
 
I believe it's a symlink in /var/html or a similar path
 
it is not on your folder?
 
No, otherwise I'd just delete it
 
but otherwise you control all the content on your site? or just your personal folder?
 
5:24 PM
Let's take DirectAdmin as example
Each VirtualHost has it's own public_html folder, of course
 
ok
 
Let's say I create a folder a in my public_html folder
And I create one in /var/www/html too, when I go to www.mydomain.com/a it'll show me the contents of /var/www/html/a/
 
ok
 
The same with cPanel
When I try to override /var/www/html with .htaccess it'll probably not work
So I guess we'd be better off looking for an alternative
 
as far as I know, .htaccess will apply to a folder and it's children
 
5:27 PM
Precisely.
So I can't 'override' the /var/ww/html with it
And as I can't access it, I can't apply rules to it
 
so if you do not have a cpanel subfolder/link, it means that cpanel could have been configured either by an alias or with a Location and some hook
 
Exactly, which is probably in /var/www/html or something similar
It's kind of a server-wide folder
 
you should try to use mod_rewrite
 
Could you give me an example of it's usage?
 
replace Redirect with the following
RewriteEngine on
RewriteBase /
 
5:29 PM
What would happen then
?
 
RewriteRule /cpanel(.*) domain.com/othersite$1 [R=301]
same results as expected
 
OK, let me try that out. I'll be back in a sec
 
at least, it should work like that
I'll test it myself
 
Nope, it just redirects me to cP
 
yup, confirmed on my side too... seems that mod_rewrite first goes to the directory, then searches for .htaccess
well, if you cannot edit apache's config files
neither locate cpanel directory
you won't be able to change that behaviour
at least to my knowledge
 
5:34 PM
Yup, I think so too.. I'll try to contact my host to be sure.
Thanks a ton for your time!!
 
no problem
sorry it didn't work
 
no problem, you tried your best.
So.. thanks and good luck in the rest of your life :p
 
same to you
 
Ty. Have a good day!
 

last day (15 days later) »