last day (25 days later) » 

8:46 PM
Welcome here Justin. Thanks for honouring my invite
I'm really having some issues with my rewrites. Stuck here for some hours
 
Ok let's try to find a solution
 
Okay
 
tell me the url you tried for getting a 404 not found page
 
Options +FollowSymLinks -MultiViews
<IfModule mod_rewrite.c>
IndexIgnore */*
# Turn mod_rewrite on
RewriteEcomine On
#RewriteBase /


# redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.url\.com$ [NC]
RewriteRule ^ http://url.com%{REQUEST_URI} [R=301,L]

# To internally forward http://xxx.url.com to http://www.url.com/?s=xxx
RewriteCond %{HTTP_HOST} ^((?!www\.).+?)\.url\.com$ [NC]
RewriteRule ^$ school.php?s=%1 [L]

# To internally forward http://xxx.url.com/yyy/ to http://www.url.com/?s=xxx&c=yyy
The above is what I have in my htaccess currently. The actual url is eportal.ng in case
What I am actually working on is this. I create users from the admin then I want every created user to be redirected to a not actually existing domain. Something like omni.url.com to url.com/users.php?id=omni
 
Ok. I'll comment the code you showed (i'll write it finally, don't worry). First, you don't really need "IfModule" tags (but if you want to keep it, that's ok, it's up to you). Then, you should uncomment the RewriteBase line
 
8:55 PM
Okay...
 
The rule to redirect "www" to non-www could be rewritten without using domain name. You can also make a little change in the trailing-slash rule and last rule
So here is how your htaccess should look like
Options +FollowSymLinks -MultiViews

RewriteEcomine On
RewriteBase /

# redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

# To internally forward xxx.url.com to url.com/school.php?s=xxx
RewriteCond %{HTTP_HOST} ^(.+?)\.url\.com$ [NC]
RewriteRule ^$ school.php?s=%1 [L]

# To internally forward xxx.url.com/yyy/ to url.com/index.php?s=xxx&c=yyy
RewriteCond %{HTTP_HOST} ^(.+?)\.url\.com$ [NC]
RewriteRule ^([^/]+)/$ index.php?s=%1&c=$1 [L]

# To internally forward xxx.url.com/yyy/zzz/ to url.com/index.php?s=xxx&c=yyy&g=zzz
don't forget to replace again "url.com" in rules
 
Let me apply this. Then one more thing. The forgot password is another issue which I couldn't fix even though I tried
 
What is it about ?
 
It is something like url.com/me/forgot.php?key=xxxx
I want to have it as url.com/me/forgot/xxx
 
oh yes i remember
 
9:07 PM
Okay
 
But if you agree, let's try first with the code i gave you now. I'm waiting for your test result
 
Internal server error
eportal.ng/school/?s=omni Same 500 Internal Server error
 
Are you sure mod_rewrite is enabled ?
 
Sure
What's this condition for? "RewriteEcomine On "
 
Could you show me your current htaccess code ?
 
9:14 PM
Here's my code

Options +FollowSymLinks -MultiViews

RewriteEcomine On
RewriteBase /

# redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

# To internally forward xxx.eportal.ng to eportal.ng/school.php?s=xxx
RewriteCond %{HTTP_HOST} ^(.+?)\.eportal\.ng$ [NC]
RewriteRule ^$ school.php?s=%1 [L]

# To internally forward xxx.eportal.ng/yyy/ to eportal.ng/index.php?s=xxx&c=yyy
RewriteCond %{HTTP_HOST} ^(.+?)\.eportal\.ng$ [NC]
RewriteRule ^([^/]+)/$ index.php?s=%1&c=$1 [L]
 
Sorry i didn't check that line. Must be RewriteEngine On and that's to start mod_rewrite engine
otherwise, looks fine to me
 
Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /

# redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

# To internally forward xxx.eportal.ng to eportal.ng/school.php?s=xxx
RewriteCond %{HTTP_HOST} ^(.+?)\.eportal\.ng$ [NC]
RewriteRule ^$ school.php?s=%1 [L]

# To internally forward xxx.eportal.ng/yyy/ to eportal.ng/index.php?s=xxx&c=yyy
RewriteCond %{HTTP_HOST} ^(.+?)\.eportal\.ng$ [NC]
RewriteRule ^([^/]+)/$ index.php?s=%1&c=$1 [L]
This is what I have now but I still get a 500 Internal Server error
 
Just to make sure, could you try to keep only those 3 lines and see what happens
Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /
 
Works fine with the 3 lines
 
ok let's add rule by rule
try to add this:
 
9:20 PM
Ookay
 
# redirect www to non-www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
fine (i'm testing it live on your site too)
 
Fine
Okay!
Works fine
 
Now, you can append this rule
# To internally forward xxx.eportal.ng to eportal.ng/school.php?s=xxx
RewriteCond %{HTTP_HOST} ^(.+?)\.eportal\.ng$ [NC]
RewriteRule ^$ school.php?s=%1 [L]
(assuming school.php exists)
 
I have uploaded school.php like I said. It has echo 112345 inside
This rule fails though
You can confirm it please
 
Well, i don't think the rule failed. Looks more like a wildcard issue. With or without that rule, you should be able to reach school.php via eportal.ng/school.php or anything.eportal.nb/school.php
 
9:25 PM
Okay....
 
Did you configure wildcard correctly ? It should have the same document root as main domain
 
How do I do that?
 
What did you do about it so far ?
 
I don't know about any separate configuration for this
 
Do you have access to your Apache server configuration file ?
 
9:31 PM
Yes
It's a VPS so I have access to all
 
Ok fine. You'll have to add a configuration for your wildcard
Something like this
NameVirtualHost *:80
<VirtualHost *:80>
ServerAdmin admin@eportal.ng
DocumentRoot "/path/to/document/root/folder/"
ServerName eportal.ng
ServerAlias *.eportal.ng

<Directory "/path/to/document/root/folder/">
Options Indexes FollowSymLinks
AllowOverride All
Order Deny,Allow
Deny from all
Allow from all
</Directory>
</VirtualHost>
 
I should place this in just as you've written?
 
yes except for "/path/to/document/root/folder/" which has to be your real path to document root folder
you must already have a DocumentRoot in your conf. You can copy its value and use it
 
Please hold let me login and apply these
 
if your configuration is ok (after a restart) you can now access school.php (or other files) from eportal.ng/school.php and anysubdomain.eportal.ng/school.php
 
9:40 PM
Okay. I am logged in to WHM. Searching for the .conf
 
9:53 PM
I have a challenge here please
 
Tell me ?
 
Getting to the .httpd file is a little challenge for me. How do I get to /usr/local/apache/conf/
 
with FTP connection ?
 
Yeah
 
well you should have httpd.conf in there (or maybe in a subdirectory of it)
I have to go but i'll be back tomorrow if you need. The code for wildcard and htaccess are fine so this should work if you make wildcard working. Otherwise, i'll be there to help you
 
10:00 PM
How else can I connect you to get your attention in case you are not here?
Thanks for your assistance so far. I'm very grateful
 

  last day (25 days later) »