Jump to content

Recommended Posts

Greetings,

 

I'm am trying to achieve the desired results below with htaccess rewrite:

 

First I want to turn away any traffic that is not from me on my development server and redirect it to my new server

 

Then I want to redirect all traffic from sub.example.com to sub.example.com/index.php

Now all traffic that is going to sub.example.com that is for a ".html" file should be directed to sub.example.com/index.php

The traffic may contain multiple sub-directories that are important and refer to connecting "departments" so this information should be passed on to be processed.

The page is also important because it determines which sub file to include. 

Also any additional gets and post should also be carried as well.

Gets should be visible to the user

 

Also I have a wordpress install on the same server

I want all traffic that is going to example.com or www.example.com to be redirected to the wordpress file

It should not appear that it is being redirected. I don't want the average joe to know that the backbone of the CMS is wordpress.

 

Here is the basic layout of the file structure:

 

root

- sub

- wordpress

 

I assume I will require a htaccess file structure like this (maybe htaccess2 is not necessary):

 

root

> .htaccess1

- sub

--> .htaccess2

- wordpress

--> .htaccess3

 
 
 
htaccess1
==============================
<IfModule mod_rewrite.c>
RewriteEngine On
 
# UNDER DEV BYE
RewriteCond %{REMOTE_ADDR} !^50\.137\.81\.108$
RewriteRule !^wp-admin/ www.currentsite.com/ [R=301,L]
 
 
#RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [L,R=301]
 
#wordpress
#RewriteRule ^www.example.com/index\.php$ - [L]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule . /index.php [L]
</IfModule>
 
 
 
htaccess2
==============================
<IfModule mod_rewrite.c>
RewriteRule ^sub\.(.+)\.html$ /sub/index.php?request=%{REQUEST_URI} [NC,L,QSA]
</IfModule>
 
.htaccess3
==============================
# BEGIN WordPress
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com[nc]
RewriteRule ^(/*)$ http://www.example.com/$1 [r=301,nc]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
 

 

 

 

Now the problem is I can't get all the features I want working together. Sometimes I can get the sub.example.com working, however it behaves oddly. When a href is clicked it will go to that page but mask it as the previous page. But when a onclick parent location is clicked it works fine....odd? 

 

When I right click on some areas of the page (in sub.example.com) it shows a frame like is found in wordpress and when I view the source it is not correct.

 

I have been caught in a loop of trial an error waiting for the light to come on. I would appreciate any assistance.

 

Thank you,

Edited by analyzethism1

Update: Turns out all my issues were caused from GoDaddy zone file issues. I added the domain through their nice "add sub domain" feature, Fixed issue by manually adding the domain in the zone file.

 

Not an htaccess issue after all.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.