wordpress permalinks with prefix for wildcard - wordpress

I'm having trouble trying to program into Wordpress a wildcard for the permalink structure. So for example, I'm trying to setup a permalink where the link is like this: foo.example.com/company. At the moment, the wildcard is in place for the URL (foo.example.com), but the permalinks are still under the root (example.com/company). Is there a way to program it so that the permalink will be matched exactly to the URL that is written. So if I entered in dsdd.example.com, the permalinks will display dsdd.example.com/company, etcc...
This kind of thing is way over my head, so if someone could provide some code examples of how to accomplish this, it would be much appreciated. Thank you.

I'm not sure what your current setup is, but I can offer advice based on my prior experience with web hosts and WordPress.
If you want to have something where the subdomain (something.example.com) is a wildcard (thiscouldbeanything.example.com) and still point to your WordPress installation, you're going to have to get your host to set up something called a Wildcard DNS Record
From your description, you might have this set up already. If so, cool.
Using the wildcard is another story. Personally, I would go with a .htaccess file, and use mod_rewrite in order to have it use the wildcard subdomain to be used in the URL.
WordPress MU (Multi User) uses something along these lines to help you set up a subdomain network, and you can probably use their .htaccess file demonstrated here
Without REALLY specific information about your setup and goals, I couldn't be as much help as I wanted to be, but good luck!

Related

How can I make www.mywebsite.com/blog?

I have my website(HTML files) in a google cloud instance.
(ex: www.mywbsite.com)
To start the blog, installed Wordpress using google cloud one-click installation at another instance, which is working fine, but to access it, I use an Ip address (different from the main website).
So, on one hand, I have the site, and at another have I have the Blog IP.
How can I merge these two things to achieve the following result?
To this:
www.mywebsite.com/blog (same instance or some link to the second)
From this:
www.mywbsite.com (instance 1) + WP Blog IP (instance 2)
If you can point me some links/tutorials to better understand and solve this, I would be appreciated.
Have to tell you I am a very inexperienced tech guy, but eagerly trying to learn.
Thanks
If you want to use like subdirectory, it has to be in your instance-1 or you can use .htaccess and redirect to your instance-2.
However, if you use like this, you can't do what you want because Apache will rewrite address again and it will see www.instance-2.com.
I hope, it will answer your question; otherwise, let me know. I will update the answer.
Edit 1 - Add links
Usage of .htaccess for redirect
Redirect and Rewrite URLs with .htaccess
Thank you.
You should install Wordpress in a subdirectory instead of using cloud launcher and having it on another server. It's really easy to install WordPress manually. This is my favorite guide for any Debian based situation, not just rpi. Also this is the guide on the WordPress Codex. Just install it to the /blog subdirectory.

Wordpress find and replace image URLs not working

I have migrated a wordpress site from a subdomain on my host, to my client's domain on their host. Only the image URL's were still linking to my subdomain. I used a find and replace plugin as well as going straight through phpmyadmin to modify the database with a find and replace command as well. I believe I was successful in changing the URLs, but apparently they are wrong, as there is an extra folder in the URLs. Now when I try to correct this, find and replace does not detect the (incorrect) URL I am trying to replace with the correct one. I have tried many variations of the URLs, from the entire thing to just parts. Any thoughts?
Trying to replace:
http://www.themaggiedress.com/public_html/themaggiedress/wp-content/uploads/
with:
http://www.themaggiedress.com/public_html/wp-content/uploads/
in the database.
Have you tried updating your permalinks?
Also make sure your 'WordPress Address (URL)' and 'Site Address (URL)' are correct in general settings? (It should not reflect the Sub Domain)
You can also manually look for the images in your Wordpress directory and make sure the links are right when investigating them in the browsers console.

Wordpress network site URL handling

I have a szenario I don't know how to solve.
I have installed a MU Wordpress site.
First problem - site path
I have two sites "www.powerdoo.com" (site1) and "www.powerdoo.com/de-de" (site2).
But I want that my main site also has default path, so the result should be "www.powerdoo.com/en-us" (site1).
Inside the network "sites" settings it is not possible to change the path for the main site.
How can i solve this?
Second problem - web.config redirect
It my first problem is solved I now want the URLs Redirect like this:
www.powerdoo.com -> www.powerdoo.com/en-us
www.powerdoo.de -> www.powerdoo.com/de-de
Can anybody help me how I have to write a rule for this?
Thanks Steffen
In that case you need to map the domains to the respective wp sites and have rewritten the base url.
This plugin will help you out to achieve those redirects, is extremely easy to set up and also it will take care of the base url rewrites.
https://wordpress.org/plugins/wordpress-mu-domain-mapping/
This way your sites will work fine with both URLs (www.powerdoo.com -> www.powerdoo.com/en-us) and most probably you won't need to mess up the theme's code.
The only thing you need to be aware of is that "if it gets to happen"
that on some places of your theme the base url rewrite doesn't work it
will be most probably due to the way the original url is generated by
WP engine inside of the theme. But if you are php handy you will be
able to fix it on the theme or the child-theme with a
str_replace();.

Change site URL should alter the table or create .htaccess?

I don't know where else to post serverfault, superuser or here, but Please accept my apology.
I got a very big tast I would say because I never done this before myself.
There is a site which they are running on Wordpress for over a year and they just bought a new domain name.
So they asked me they want to just change the domain name of the http://oldsite.com to the http://newsite.com what happen to myself before when I have the same situation I just move from one server to another server and changed the domain name at the same time with wordpress they store the URL of the images like absolute url not like relative so sure that many images will not be display.
So in his case that they are still going to use the same server which means all the picture will still be in the same folder /wp-content/uploads/*
So my question is how can I change his domain name without affecting the pictures in his site after changed the domain?
Doing alter table? or .htaccess mod rewrite?
if there is any better option please suggest me I would be so much apprecaited :)
Thanks and again please accept my apology for not knowing where to post.
UPDATE
The only and most important thing is that how to make all the pictures from all the posts still appear after change the domain.
Try putting this in the htaccess file in the document root of the oldsite.com domain:
Redirect 301 / http://newsite.com/

WordPress with Yahoo! Hosting... Almost there

EDIT:
Yeah, so this problem is really unsolvable. Yahoo prevents access to .htaccess, even from WordPress itself trying to change it. I had to settle for writing a script on the default homepage that redirects browsers to "www.abc.com/index.php" if they go straight to "www.abc.com". You always have to deal with "index.php" being in the address bar but it's better than not having permalinks...
/EDIT
Yahoo! Small Business hosting seems specifically engineered to make WordPress difficult-- but it's my client's host and there's not much I can do about it. I'm trying to move WordPress into the root directory, and I'm sooo close to having it done.
I've read and read and read about how to get the Permalinks to work right, and since Yahoo! hosting doesn't let you modify htaccess I am pretty much up s*** creek. I'm using the simple permalink structure of "/%postname%/", which once I moved to the root, stopped working. I have changed it to "/index.php/%postname%/", which allows you to see the pages if you manually type in index.php before the page name or if you are logged into the admin area and "View Page". Also, the correct permalink shows on all of the pages in the editor.
However, WordPress doesn't let you change the permalink of the static page you use as the front page.
Long story short, if I go to "www.abc.com/index.php", the links in the menu all work fine. However, if I just got to "www.abc.com", the links don't pick up the "index.php" from the permalink structure. I need to fix this, so if anyone knows how to either:
Change the permalink of the static front page
Fix something in the database if I install PhpMyAdmin
Work around not having access to .htaccess
Put a small script somewhere on the index page to append "index.php" to the url
Any other suggestions
It seems it would work if I was NOT using a static front page but rather the blog, but this isn't an option. I've tried changing the "Tag base" setting to no avail, as well as deactivating the Yahoo! Custom Permalinks plugin (and reactivating it again after that failed...). Could really use some help!
Check out Giving Wordpress its own directory. I can see how this could solve your problem. Also make sure that you have done the obvious, and change your url for WordPress address (URL) Site address (URL) inside the general settings page. Perhaps the static homepage should be developed outside of wordpress, and then you can follow the steps provided in the link I provided. Hope this solves your issue.
Yahoo doesn't allow users access to the htaccess file which means that you can't the mod_rewrite rules needed for custom permlinks. The Only way around it that i've heard it works (never tried it myself) is to add /index.php/ to the beginning of your custom structure so: Go to Permalink Settings > Select Custom Structure. And set the value as /index.php/%postname%/ or what ever you want as long as you add /index.php/ before it.
Hope this helps.
I had a similar problem with this host (in 2018! 4 years after your question) that I finally solved by changing the permalink settings.
Settings > Permalink Settings > Custom Structure: /index.php/%postname%/
I wish there was a better solution but Yahoo Small Business still doesn't allow .htaccess files - after several frustrating rounds with customer service, I finally admitted defeat and used this work around.

Resources