How to achieve sub-directory sites in wordpress multisite? - wordpress

I have a wordpress setup with Network admin enabled.
And I have following different sites configured.
http://example.com/ipl ,
http://example.com/cricket,
http://example.com/football,
http://example.com/ileague,
http://example.com/sports
But what I want to configure is the following without redirecting (URL should not change in the address bar)
http://example.com/sports/cricket should serve content from
http://example.com/cricket
http://example.com/sports/cricket/ipl should serve content from http://example.com/ipl
http://example.com/sports/football should serve content from http://example.com/football
http://example.com/sports/football/ileague should serve content from http://example.com/ileague

Please add following code in .htacess file.
RewriteRule ^sports/cricket/ipl?$ /ipl [NC]
RewriteRule ^sports/cricket?$ /cricket [NC]
RewriteRule ^sports/football/ileague?$ /football [NC]
RewriteRule ^sports/football?$ /football [NC]

Related

Domain name automatically directing to HTTPS instead of HTTP i have no SSL cert

So i had a wordpress blog in wordpress.com. I mapped the domain name to it through godaddy.
The domain name was https://domain.com/ when it was active on wordpress.com however i moved my site to a self hosted site and adjusted the domain accordingly to point to fatcow subdirectory.
After mapping the site i noticed that in firefox i was able to see my self hosted website but in other browsers like chrome and IE i could not i would get the message below.
Your connection is not private
Attackers might be trying to steal your information from pogosmart.com
(for example, passwords, messages, or credit cards).
NET::ERR_CERT_COMMON_NAME_INVALID"
I also noticed that the site was going to Https not http, i have not purchased an SSL cert so i don't understand why i had access to https when i was hosted in wordpress.com... now that i am not, the domain still uses https.
How can i make my website http://domain.com/ instead of https://domain.com/ https is causing a "your connection is not private" error.
If this is not enough information let me know
You'll need to check two places.
One is the WordPress setting for the site's URL. If you can log into the dashboard, you can find it under general settings. Just take the 's' out of 'https' in the URL.
If you can't log into WordPress, you'll need direct access to the database, probably through phpMyAdmin. Browse the wp_options table, and locate options named 'siteurl' and 'home' and change both to remove the same 's'.
Next, check for a file in the root of your WordPress site called .htaccess. This may contain some code that redirects incoming traffic to the secure version of your URL.
Remove anything like:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain\.com [NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://domain.com/$1 [R,L]
Your .htaccess should only contain something like:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase //
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . //index.php [L]
</IfModule>
# END WordPress
... and maybe some extra stuff from any security plugins you may use.

Drupal returning 404 on images when not prefixed with www

I'm attempting to help a friend configure their drupal site on the latest Drupal 7 release. I am being returned 404 on some images but not others.
Works:
http://www.example.com/sites/default/files/fs_pic_sm.jpg
Doesn't work:
http://example.com/sites/default/files/fs_pic_sm.jpg
What are the configuration steps needed to serve both? I'm not familiar with Drupal so if there is pertinent information I have omitted please inform me and I'll update this question.
This could be a server setting as www.example.com and example.com are considered two different sites (www is a subdomain).
Edit your .htaccesss file in your document root and uncomment the lines:
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
This way they are automatically redirected to www and should no longer see the 404.

htaccess subdomain folder in wordpress

I need some help on the htaccess subdomain to be pointed to specific file in a folder for a wordpress site.
Currently I have this in my .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^subdomain\.domain\.com$
RewriteCond %{REQUEST_URI} !^/subdomain/
RewriteRule (.*) /subdomain/$1
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$
RewriteRule ^subdomain/(.*)$ http://subdomain.domain.com/$1
When the user enters subdomain.domain.com it will access the domain.com/subdomain folder and when it enter domain.com/subdomain it will redirect to subdomain.domain.com. (this is exactly what i want to happen)
Problem is inside the wordpress of the subdomain because it still referrer to the main domain (i.e. the images is still domain.com/wp-content/uploads/... instead of subdomain.domain.com/wp-content/uploads/... or at least domain.com/subdomain/wp-content/uploads/...).
How do I make the subdomain access the its folder in .htaccess?
Been doing this for days now. please help. thanks!
Open your WordPress installation's general settings.
Change your Site Address (URL) to http://subdomain.domain.com/. This will fix the links generated on all the blog pages to use the sub-domain instead of the main one.

Using .htaccess to redirect a domain to another URL

I have a site running wordpress, it's the full site. One of the pages is like a contact-us form located at www.ourdomain.com/contact-us/
I also have a URL like contactourdomain.com and I want it to redirect to www.ourdomain.com/contact-us/
We used to do this with a redirect on network solutions, but I prefer to have it all done right on the server if possible. I've got it sort of working but when you visit the link is still says contactourdomain.com/contact-us/ as the URL, and that breaks all the other ones.
Any suggestions?
.htaccess
Options -MultiViews
RewriteEngine on
RewriteBase /
# Rewrite
RewriteRule ^(.*)$ http://www.ourdomain.com/contact-us//$1 [L]
if you add this in .htaccess is it working?:
RewriteRule ^$ contact-us/ [R=301,L]
keep me posted..

htaccess url rewriting question

I have a site made with CodeIgniter with a WordPress site at /blog.
Say I create a page in WordPress that can be viewed at /blog/my-page.
Is it possible to rewrite the URL with .htaccess to remove the blog part of the URL? So I could enter my site url /my-page to view the page?
from the top of my head..
#start the engine
RewriteEngine on
#requests to www.yourpage.com/anything/
RewriteCond %{REQUEST_URI} ^/([^/]+)/?$ [NC]
#are sent to www.yourpage.com/blog/anything/
RewriteRule .* /blog/%1 [L]
The rule below will rewrite (internal redirect) /my-page to /blog/my-page:
RewriteEngine On
RewriteBase /
RewriteRule ^my-page$ /blog/my-page [NC,L]
RewriteRule ^another-page$ /blog/another-page [NC,L]
This needs to be placed in .htaccess in website root folder.
If you already have some rewrite rules there then this one need to be placed in appropriate place as order of rules matters.
You still may need configure WordPress a bit so it understands that this URL is for him to process (WordPress may still see the original URL). I have not worked with WordPress that much to tell if this will be required (and how to do it if it is) -- but look at Permalinks settings.

Resources