first off...thank you so much for your time.
I was referred to you guys and heard here's the best place to find a solution.
Ok...so here's the problem.
My old programmer set up the wordpress permalinks to be dynamic, but we all know that they are the worst to pull in traffic from search engines (specially google).
So I need an expert to set it to custom structure, which will show the words on the title on the URL or "URL friendly links" if you may.
I have some knowledge of computers/programming myself and so I tried to log in on our site's wordpress admin page, and change the permalinks to "custom structure": /%category%/%postname%/
Then also add the word : "categories" on the "category base" and "tag" on "tag base".
What happens however is that when we change that the url links are successfully changed, however...evertime you click on a category link, it takes you back to the main page of the site (instead of the category you chose). That also happens when you click on the pages menu on the site (at the bottom of the pages. ex: 1,2,3,4,5...) it doesn't take you to those pages instead, back to the main pages.
I think it's something that was done to the theme of the actual wodrpress, instead of the FTP, etc...
It might be something simple and fast, but I just can't seem to do it myself.
Edited to add:
By the way...forgot to mention. I already added this to my htaccess. file
RewriteEngine on
ErrorDocument 404 /404.shtml
# BEGIN WordPress
# END WordPress
RewriteCond %{HTTP_HOST} ^thehypebr.uol.virgula.com.br$ [OR]
RewriteCond %{HTTP_HOST} ^www.thehypebr.uol.virgula.com.br$
RewriteRule ^/?$ "http\:\/\/thehypebr\.com" [R=301,L]
then i deleted it all and only have:
# BEGIN WordPress
# END WordPress
Looks like the rewrite rules necessary for pretty urls were not added to your .htaccess files like they were supposed to (as you can see, the wordpress part is empty but it should not be).
Maybe the permissions on .htaccess were too tight. Try setting the permissions on your .htaccess file to be world-writable. Then switch back to dynamic urls, then back to custom structure. Theoretically, if permissions were the problem, wordpress will fill in the rules now. And then you can set the permissions on .htaccess back to normal.
When you log into the backend of Wordpress and go to your permalinks section try hitting the save button again. Once the page refreshes saying it saved it, scroll to the bottom of the page and there should be a paragraph telling you what the .htaccess file should have in it. ( It is usally a grey or yellow background paragraph ) Copy that and paste it into your .htaccess file instead of what you have now. This should help add the correct rules.
It usually looks like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Related
I was wondering if someone could help us out with this one.
We have a site that has lots of insecure links in various pages across the site. Some pages are also including images from http sources and not https.
An example page is here: https://mindfulpresenter.com/mindful-blog/the-10-most-important-things-in-presenting-today/ - on here you will see that there are some links to http pages and the page is sourcing an image from http.
I was hoping that all of these issues can be resolved by making changes to the htaccess file.
The current htaccess file looks 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
Can the issues be resolved by making changes to the htaccess file? If so, what do I need to add to it?
Many thanks
James
It appears, that the links are in the content of your pages / posts which is stored in the database as text. I recommend doing a search & replace to achieve a "clean" state.
There are some plugins that parse the content and create those links dynamically but i don't think that is the most elegant solution.
There are a lot of plugins that may help you. I use SSL Insecure Content Fixer on my website and it works great.
You can, in fact, modify the contents of the page as it is being served, using mod_substitute: https://httpd.apache.org/docs/current/mod/mod_substitute.html
In particular, you'd do something like:
Substitute s/src="http:/src="https:/i
See the mod_substitute docs for further information and examples.
I found a 'Search and Replace' plugin for WordPress which searched the database and replaced all of the HTTP entries.
I've recently relocated a WordPress site to a new host. I followed the instructions from here and things seemed to go ok. However on the old host the installation was inside a sub-folder (news). On the new host I want it in the public_html folder. All files are up, I have made the appropriate changes to the wp_config file, I have edited the .htaccess file and removed any references to the old path, I have even gone into the wp_options table and made the url changes there.
However for some reason whenever I reference the index.php, it tries to point back to the old sub-folder location. I've looked in the wp-settings, wp-load files etc and for the life of me cannot find where the bad path information is.
I've gone to the wordpress.org site and several other sites, any help would be appreciated.
UPDATE: I deleted my wp_config file and the system asked me to setup, so I did. During the setup it recognized that the database was there, etc, and sent me to the login. I was able to login, looked at the settings, etc and they are all as they are supposed to be.
If I go directly to wp-admin or wp-login it lets me log in with no problem. however when I try to go to the site, nothing, however instead of showing the old url, it now shows a blank screen.
Thanks
First of all make sure that your whole database does not contain any references to the old installation otherwise some redirection may be active. For migrating your database nowadays you use the following tool to make sure that also serialized data does not contain any references to the old URL:
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Can you reach your backend? If only the frontend does not work its probably a permalink problem update your permalinks by going to Settings -> Permalinks -> Save (Update)
Check your index.php and the index.php file from the main directory and also from the subdirectory if there any redirection is active
Do a search (and replace) for the content of all files within your WordPress installation and check for any possible hardcoded redirection
It MUST be one of those problems.
If still no success debug your WordPress installation step-by-step (with echo "reached"; die;) to find out WHEN the redirection is happening - important points to check:
index.php file
wp-config.php file
Action Hook 'init'
Action Hook 'template_redirect'
This might also be helpful: http://rachievee.com/the-wordpress-hooks-firing-sequence/
Check your .htaccess file.
You probably have something that looks like this(notice the subfolder):
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subfolder/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subfolder/index.php [L]
</IfModule>
# END WordPress
When you should actually have something that looks 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
First although neither of the two posted answers solved the problem, they both were instrumental in helping me figure out what was wrong, so I voted each of them up.
Since I could log into the admin area, I knew things were pointing to the correct place. But I was still getting a blank page, well it turns out that somehow in the ftp transfer of the backup site to the server, the 'themes' folder didn't make it. Once I uploaded that folder, things are close to being back to normal.
Again, the advice I received helped me tremendously in troubleshooting this sucker. Thanks
I want to make a better link shortener service using YOURLS. I've procured a short URL for this: sly.pe. YOURLS is installed and sly.pe/admin is accessible.
I'd also like to use WordPress to power most of the consumer facing site, at the URL: sly.pe. The idea being I want users to register for the site using WordPress and a registration plugin like OneAll social. Once authenticated they get logged in for both YOURLS and WordPress and are redirected to a URL like sly.pe/home that uses WordPress as the site but YOURLS (sly.pe/admin for that user) is embedded and accessible somehow.
Both services make .htaccess changes. If I leave the file as is, I can't seem to have any other WordPress URL other than sly.pe, but YOURLS works fine. If I comment out some YOURLS code, WordPress can use other directories, but then YOURLS doesn't work. How can I have both coexist nicely? Or at least define the WordPress URLs I want and get those working?
(commenting out the YOURLS code gets WordPress working, but breaks YOURLS):
.htaccess:
# BEGIN YOURLS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /yourls-loader.php [L]
</IfModule>
# END YOURLS
# 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 was able to get YOURLS to work with WordPress. Here's how I did it...
I've placed YOURLS in niemannross.com/links - so for me, a redirect looks like http://niemannross.com/link/rlunchlessons
Install the Redirection plugin by John Godley in your copy of WordPress.
Look in Wordpress:Admin:Tools:Redirection. Across the top are several tabs. You should see Redirects | Groups | Logs | 404s | Import/Export | Options | Support.
Choose Redirects
Select Add New Redirection
Source URL: /link/.* - Select Regex.
Target URL: /link/yourls-loader.php
Group: Whatever makes sense in your setup. I've chosen wordpress:redirections
This works for my installation.
Simple answer is: you cannot. Both WordPress and YOURLS (please, YOURLS, not YourLS) need to process server requests to return the expected result (eg when requesting http://sho.rt/blah, each app needs to check if blah is content it manages)
Long answer: you should not because all of the following.
Basically you would need something that works when:
blah is an WP article but not a YOURLS short URL
blah is a YOURLS short URL but not an WP article
blah is neither a WP article or a YOURLS short URL
optionally decide what to do when blah is both a WP article and a YOURLS short URL
Your code would also need to :
prevent WP to create a "slug" that is already a YOURLS short URL
prevent YOURLS to create a short URL that already matches a WP slug
You'd need to have code for this both in the WP area and in the YOURLS area.
Bottom line: lots of edge cases to deal with. What might work in some case on your side might not work in other cases, on your side or with others.
I think you're going to have to work around the problem as mentioned by #Ozh, but here's a plugin that will make it easier for your WordPress users to use YOURLS: https://wordpress.org/plugins/yourls-link-creator/
You cannot, I tried different ways, maybe with new apache 2.4 using the if else statement you will, but I am not an expert on those commands, I want to share what I did to have the shortener option in the root page and the html site in a subdirectory, with this solution you can still give people normal url for the website (e.g. sho.rt):
set your website in a folder under root with a name e.g. "w", that means it will be at "sho.rt/w"
then use this .htaccess
# BEGIN YOURLS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /yourls-loader.php [L]
RewriteRule ^$ /w [L]
</IfModule>
# END YOURLS
This will give you the option to still use sho.rt as your website address if the user doesn't pass any subfolder in the url, but if they do, it will check in yourls first and go to your folders if nothing found.
One more thing, do not forget to add "w" in the $yourls_reserved_URL array in /user/config.php (Yourls config file)
I finally solved this for my website.
I have a subdomain http://sub.domain where I installed YOURLS, but the short URLs are at http://domain/someshortlink
And the wordpress website is also at http://domain/
It used to work with the swap plugin ( https://github.com/gerbz/Yourls-Swap-Short-Url ).
Just with the htaccess provided by that YOURLS plugin, and no wordpress. But since I decided to move to wordpress, this combination won't work.
Here is the trick:
On your htaccess, keep it simple, as wordpress wants it to be. Remove the snippet htaccess for the YOURLS swap plugin, if you have it added.
Edit your 404.php page theme. Mine was at: wp-content/themes/twentynine/404.php
At the very begin, just add:
<?php
header('Location: http://sub.domain' . $_SERVER['REQUEST_URI'] );
exit;
?>
This will allow:
All files and directories will honor the basic htaccess from which they are simply served
All URLS not files and folders will be handled by wordpress in the usual manner.
If a page is not found, wordpress will trigger 404.php which will send that page to YOURLS to try
If YOURLS also don't find it, a 404 page from YOURLS will show.
Remember to edit the 404 page from YOURLS also, to match your wordpress theme.
Best of luck!
Reference: https://github.com/gerbz/Yourls-Swap-Short-Url/issues/11
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.
I'm using Wordpress 3.1.1 and recently reorganized my page (deleted and moved a lot of pages). Now I get 404-errors when accessing some pages (all posts and tags work fine).
I can disable the permalinks and then access all pages without problems. I can also rename the pages (e.g. contact --> contact1) and all links work again for the new names. However, if I rename them back, I get the same 404 error again. It seems like some kind of caching-problem. Any ideas how to fix it? Thanks!
My .htaccess for the root directory:
# 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
Try clearing your 'trash' can in Wordpress, annoyingly items in the trash area still use a permalink, and when accessing those links you'd get 404 message.
Also delete your htaccess file (if it has no additional settings in it), and the reset your permalink settings.
Ian.
I finally solved it. I realized, that there were some page names, that produced a server 404 and some, that don't. Then I took a closer look at my directory structure:
I access my blog from the root path (not the worpdrpess-directory which is located in it). So I can enter
www.myurl.com
instead of
www.myurl.com/wordpress
So far, so good. However, I had some files in my root directory, that had the same name as the page I was trying to access.
Eg. if there is a contact.abc (the extension doesn't matter) in the root folder, then getting
www.myurl.com/contact
will produce a 404-error. If I rename the file everything works fine. Hopefully, that will help others as well.