.htaccess subdomain languages - wordpress

Im running a WordPress site with qTranslate installed.
The URLS are currently displayed as http://domain.com/en/ but i would like to change them to
http://en.domain.com
How do i make this work? qTranslate has a built-in pre-domain mode, which should do exactly what i need. But all it does is change the links (works), when visiting the page i get a 404 error.
In the admin it says "Pre-Path and Pre-Domain mode will only work with mod_rewrite/pretty permalinks. Additional Configuration is needed for Pre-Domain mode!"
I got pre-path working and i think im using pretty permalinks (/%category%/%postname%/), but ive got no idea what kind of 'additional configuration' is needed.
My .htaccess looks like this (i think standard wp output);
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
I tried a lot of different things found online, but i mostly get internal server errors or just the 404.
Thanks in advance!

If your default url starts with www (like www.domain.com) then your translated urls will look like en.www.domain.com.
But if you try to login en.domain.com, you may think that your plugin doesn't working.
Before try anything be sure that any subdomains shows your WordPress homepage. With default settings WordPress should not redirect to you anywhere.
Then set your default url without www prefix (for ex. domain.com)
And check the permalink finally
If you fail at any steps, disable all plugins and even change your theme to default one.

You'd have to add wildcard domain setting at your DNS settings for the domain. https://codex.wordpress.org/Configuring_Wildcard_Subdomains‎
Wildcard domain redirect with WordPress See also this post.

Related

Wordpress permalinks does not work on server

I have uploaded WordPress website to a new server which is working fine. But Permalinks settings are not working. All other pages returning me 404 error.
and below in my .htaccess file
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
please check the apache module rewrite.
in a root wordpress folder insert into index.php phpinfo();
and find this string mod_rewrite. If it`s not, tell it your hoster support
To fix this error one can also try this method:
Open phpmyadmin > wordpress database > wp_options table
Here check first two fields and update option_value with correct WordPress location. After that reload the permalink, hopefully the error might gone
Go to "wp-admin", open settings->permalinks and update the permalink settings, it will update the .htaccess file on your server. Hard refresh your site, now all the links will be work perfectly.
there's a one tiny trick to update all links if you can access admin .
you just go to permalinks options from settings page and save permalinks to default and after saving it you may change again and update. This will work in most cases for me either its SSL based issue or urls mismatch. don't forget to view .htaccess file if you have old server and having multiple rewrites.

Wordpress 3.8 Subdomain redirects every time to the Login Page and Permalinks throw 404 error

As you can see, I have two problems. But both are equally important for me.
What i want:
1. I want to redirect my domain "www.domain.de/blog" to "blog.domain.de".
2. I want to enable the "pretty" Permalinks over the Worpress Admin Panel.
Background Information:
I have my own Server with root Rights, Ubuntu and full Access.
Domain from united-domains on the Folder /var/www/domain.de.
My Subdomain redirects to "var/www/domain.de/blog/current"
Wordpress is in the folder "var/www/domain.de/blog/current"
My Wordpress is a single Blog, no Multisite!
My Document root points to "var/www/domain.de"
1. Case:
I created the subdomain "blog.domain.de" in united-domains and redirect to the folder /var/www/domain.de/blog. In WordPress I have set the two URL fields on blog.domain.de.
And here is the first problem. I can visit the site with the url blog.domain.de, but when I want to login via wp-login, then the URL makes nothing and I get a complete white Page. When I now go back to the blog.domain.de, than I am logged in, but every step who wants a Login will redirect to the wp-login site and I am no longer logged in.
I have cleared the cache and google the problem, but all solutions are for Multisites and not working with my Wordpress.
2. Case:
When I enable the Permalinks on the Wordpress Settings and go to a single Post, it's return a 404 Error.
Wordpress has acces to the .htaccess file (chmod 0777 rights) and write the Rewrite Rule like this:
# 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
Problem solved for Case 1 AND 2
Okay, I asked the Question to the host of my Server, too. And they have a Web Application Firewall before my Server, which don't allow Subdomains. My host have added the subdomains to the firewall, and now all is working like a charm. :)
Thanks for the special help!
On point 2:
Can you please try adjusting:
RewriteBase /domain.de/blog/current/
to:
RewriteBase /
Also I usually have the following path in the last rewrite line (instead of the full path, specified in yours: /domain.de/blog/current/index.php):
RewriteRule . /index.php [L]
These both adjustments could set the proper .htaccess rewrite rules and that could fix the point 1 issue.
On point 1:
If issue 1 is not fixed yet, you should try debugging to find the actual error you are experiencing. You should start by adding the following setting in the wp-config.php:
define( 'WP_DEBUG', true );
Let me know the results and I'll try to help further (if needed).

Fishpig Wordpress Magento - http://example.com/blog resolves to www.example.com rather than www.example.com/blog

I have a working Fishpig Wordpress Magento instance on a production server.
All the green ticks show it has succesfully configured and when visiting
http://www.example.com/blog
it works. However when I try and and visit
http://example.com/blog
it sends me back to the magento home page at www.example.com .
I have tried setting the url in wordpress to both http://example.com/blog and http://www.example.com/blog but in both situations it always sends me to the home page at site.com.
This is a concern because most experienced web users will not type www when trying to access a location.
My htaccess is as generated by Wordpress and looks like
DirectoryIndex index.html index.php
<IfModule mod_rewrite.c>
#wp generated
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Please not the wordpress site files are located at site.com/wp and it is the fishpig extension which arranges the direct from the non existent /blog path.
First of all, to start of, one way to resolve the issue is to simply make your Magento website DEFAULT to not have the www. in the url.
In Magento, go to System > Configuration > Web.
In the "Secure" and "Unsecure" tabs, find "Base URL."
The value should look something like this:
http://www.site.com/
Replace ALL references to the domain so it shows:
http://site.com/
Unfortunately, there may be a lot of appearances of it throughout the site. You'll need to do the same thing elsewhere on the server.
If you really want your site/blog to say www., though, you'll have to properly forward the .htaccess file in Magento. I'm not too keen on how Magento's .htaccess file works, but I do know how to forward a url and keep all of its additional pages as well (however, Magento's setup may interfere).
The code should look something like this:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^site.com$ [NC,OR]
RewriteRule ^(.*)$ http://www.site.com$1 [R=301,L]
Again, I don't know how well this will work with Magento's set up, but I've successfully used the above code to redirect url's to the correct url I want. That code above was actually used on a wordpress site, though.
Check for Rewrite rules in Magento's .htaccess file and try putting this above it. Be careful, though; it is VERY easy to cause 500 internal server errors if you mess up the .htaccess file, so always keep a backup.
Try this out and I hope it helps.

Wordpress permalink structure change issue

I have seen some other posts on SO about this issue, however none of the suggested solutions did work for me, so I repost.
After changing my permalink structure to /%postname%/, none of the links is working. I get the following 404:
Not Found
The requested URL /my-post-name/ was not found on this server.
Apache/2.2.20 (Ubuntu) Server at mysite.com Port 80
When I get back to the default permalink structure it starts to work again, but I want to have /%postname%/ structure anyways.
My .htaccess file's chmod is 777.
After updating my permalink structure to /%postname%/, the .htaccess file generated by Wordpress is the following:
# 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
Any thoughts?
Edit:
I tried to change permalink structure to the following:
/index.php/%postname%/
and it happily worked. However, the problem is now, not surprisingly, the links are in the following form:
www.mysite.com/index.php/my-page.com
My question is how can I remove index.php from my links. When I remove it from the permalink structure (i.e., /%postname%/), my links no longer work.
PS: Instead of using blog entries I use only pages in my site. If it is necessary my site is: mll.sehir.edu.tr.
There are many ways how you can fix this issue, if you know the root of the issue.
Problem 1
Firstly, it may be a problem with your apache not having the mod_rewrite.c module installed or enabled.
For this reason, you would have to enable it as follows
Open up your console and type into it, this:
sudo a2enmod rewrite
Restart your apache server.
service apache2 restart
Problem 2
You may also, in addition to the above, if it does not work, have to change the override rule from the apache conf file (either apache2.conf, http.conf , or 000-default file).
Locate Directory /var/www/
Change the Override None to Override All
Problem 3
If you get an error stating rewrite module is not found, then probably your userdir module is not enabled. For this reason you need to enable it.
Type this into the console:
sudo a2enmod userdir
Then try enabling the rewrite module if still not enabled (as mentioned above).
To read further on this, you can visit this site: http://seventhsoulmountain.blogspot.com/2014/02/wordpress-permalink-ubuntu-problem-solutions.html
Sounds like a problem with symlinks on your server. Try this in your .htaccess and also please change it to 644 after making the change:
Options +FollowSymlinks
RewriteEngine on
# 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
I had the same problem but i am using other url structure /%category%/%postname%/
The problems with de 404 error is because even if you set a certain structure, wordpress is always trying to create the urls with the word "category" on the url.
Try to type your urls like this: yoursite.com/category/postname, if you are not getting any error now is because we are close to resolving the error. Now try to install this wordpress plugin http://wordpress.org/extend/plugins/no-category-base-wpml/ to remove the "category" base from urls
Let me know about your progress
Replace and try your .htaccess with this:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^hostname.com$
RewriteRule ^(.*)$ http://www.hostname.com/$1 [R=permanent,L]
I got this issue whenever i try to enable my site's permalink to mod_rewrite: "Pretty Permalinks". My site is one instance on AWS EC2.
404 Errors
Page Not Found
The requested URL .... was not found on this server.
Apache/2.4.7 (Ubuntu) Server at mydomain.com Port 80
I tried all above methods, but not being fixed.
At last, I checked the /etc/apache2/sites-available/wordpress.conf, I found I used public IP address assigned to each instance by AWS. Once I change it to the current mydomain.com, it's working.
Sometimes, wordpress.conf would be locked by httpd (web serser), we need to stop and start it after edit. We also need to use: sudo service apache2 stop/start so as wordpress.conf could be reload again.
Hope my experience could help others.

Wordpress + multilingual plugin (qtranslate) will not show the translation when switching languages

the problem I have with the multilingual plugin (qTranslate), is that it won't switch to another language it gives me 404 when trying to switch the language of posts.
This can be a result of either:
* WordPress is installed in a directory (not root) and you're using default links.
* URL rewriting is not enabled in your web server.
* The web server cannot write to the .htaccess file
I have my htaccess file with 644 and the following code is in there:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
And I'm using a custom permalinks structure: /%category%/%postname%/
but I still have 404 when trying to switch language.
anybody knows what else could be adffecting the translation plugin?
i don't know if this can help, but i had a kind of similar issue, only with the search results. with method get it was working fine for the main language, but english made 404, with method post for english, and german went to the home-page.
then i changed the url in the wp general settings from abc.com/def to abc.com (i had the directory in both fields and removed it from both). wp is not in www, but www-directory is redirected to the wp-folder. so the subdir was not necessary anymore (had it put for development). and, don't know why, but after this, the post method-search worked well like described in the wp-forum ( http://www.qianqin.de/qtranslate/forum/ ) where you can find lots of useful tips for qtranslate issues. also applying the gettext might help: http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&t=294&sid=5be0c994e226ab99b5bed7c28a250bab
hope this helps.

Resources