mercredi 29 juin 2016

Mod rewrite + Wordpress + Static site

I have a wordpress site that is currently up and functional, but I need to add a full non-wordpress site on top of it so that:

  1. All the current wordpress pages/subpages/etc need to be directed as is.
  2. Home page needs to be directed to home.php (where the add-on site's index file resides).
  3. This home page needs to accept the GET parameters and include the appropriate partial files for content.
  4. Although it would be so much easier having the wordpress site in a subdirectory or even a subdomain instead, I can't change any of the original URL structure due to SEO purposes.

I'm guessing it would help if you can get a look at the site.

The site in question is http://www.pos.com. Notice that when you do http://pos.com (without the www), it goes to the page it's supposed to go to, but when you click on "more info" and click on an icon, it tries to go into the wordpress part and do a search.

You can also see that when you try going to http://ift.tt/292dusl, it redirects properly, but when you try http://ift.tt/292W7Ek, it doesn't.

Both sites are working fine in itself, but once I combine them, that's where all the issues arise. Currently this is what I have so far for the rewrites.

Options -MultiViews
Options +FollowSymlinks
IndexIgnore */*
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_HOST} ^(www.)?domain.com [NC]
RewriteCond %{REQUEST_URI} ^/$
Rewriterule ^(.*)$ home.php [L]

# I'm trying to redirect both domain.com and www.domain.com root to home.php. 
# There are some icons that the use will select that will in turn reload the page and include partial files with content. 

RewriteRule ^site/(.*)$ page.php?&page=$1 [L]
# Site specific static files are routed to page.php with the page variable being used to pull that specific partial file. 

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(retail\-pos\-for\-growth)/([^/]+)$ home.php?size=growth&industry=retail&friendly=$1&type=$2 [L]
RewriteRule ^(hospitality\-pos\-for\-growth)/([^/]+)$ home.php?size=growth&industry=hospitality&friendly=$1&type=$2 [L]
RewriteRule ^(retail\-pos\-for\-enterprise)/([^/]+)$ home.php?size=enterprise&industry=retail&friendly=$1&type=$2 [L]
RewriteRule ^(hospitality\-pos\-for\-enterprise)/([^/]+)$ home.php?size=enterprise&industry=hospitality&friendly=$1&type=$2 [L]
# Any requests that match above should redirect to home.php with those get variables. The page will include the respective content files.

# Default Wordpress Rewrites
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Maybe I'm not explaining it too well, so if you have any further questions please let me know.

Thanks in advance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire