Wordpress redirects to a certain path - wordpress

After moving my Wordpress-site from /portfolio/ to root, it still redirects back to /portfolio/.
I followed https://codex.wordpress.org/Moving_WordPress#Moving_Directories_On_Your_Existing_Server so I changed the URL's in Settings ยป General and then moved the whole directory.
I also tried changing the permalinks to something else.
set to plain, it redirects to /portfolio/,
set to Month and name, it redirects to /2017/02/portfolio-website/.
set to my preferred structure, %category%/%postname%/, it redirects to /work/portfolio-website/
My guess is that it does that because it looks for anything with 'portfolio' in the name.
I have no idea what causes it.
My .htaccess has the following content:
# 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
EDIT:
The URL is: http://aartdenbraber.nl/

Related

WordPress Permalinks only work with index.php in the URL

When I try to change my WordPress Permalink settings, links to posts and pages return a 404 page. I have found the only way to get them to work is to either use Plain permalinks or to include /index.php/ in my permalink url, like domain.com/index.php/postname. How can I get them to work without index.php being part of the URL?
My .htaccess is below, and I have also used the .htaccess suggested at https://wordpress.org/support/article/using-permalinks/#creating-and-editing-htaccess, but changes to the permalinks puts the code below back into the htaccess file. Mod_rewrite is enabled on my Apache server.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L]
</IfModule>
# END WordPress

Some WordPress permalink problems, probably depending by wrong .htaccess configuration?

I have import on my local webserver a backup of a website made using WordPress but I am finding some difficulties with PermaLink configuration
The main problem is that if I use the permalink setted as Article Name I can see the homepage but if I click on the articles links into the homepage (to see the article) I always obtain the following message error:
Not Found
The requested URL
/wordpress35/2012/10/11/se-milano-avesse-il-mare-anzi-no-la-montagna-di-campiglio/
was not found on this server.
If I instead I use the Default settings for permalink (http://localhost/wordpress35/?p=123) I have no problem and I can access to the articles in my website
I think that this is a .htaccess problem. Can you help me to create an .htaccess file that solve this problem?
My actual .htaccess file is:
# 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 need to use the URL format described as: http://localhost/wordpress35/my-article-name
Did you try creating a the wordpress .htaccess for your needs?
# 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
This should work if you didn't specify any change in the website's URL.
(If the homepage is still http://localhost/wordpress35/ )

Ignoring url prefix using wordpress permalinks

I'm trying to set up an htaccess rule that'll work with the current permalink structure i have.
The current permalink structure I have is this
/%category%/%postname%/
And my htaccess is as follows
<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>
And a typical url would be
/blog/post_category_name/post_name/
Which all works well and good. The problem I'm facing is that a user is able to change their locale which in turn prefixes the url with the region cod as below.
/uk/blog/post_category_name/post_name/
The problem now is that WP takes blog as the category and post_category_name as the post name which then throws a 404 within WP.
Essentially I want to completely ignore the region code, is this possible?
I should also add, that the uk (or any other region) directory doesn't exist,
Thanks
If you want to catch the uk/ folder, you have to do that at the root directory. Put this in the root .htaccess (you can check for !-f and !-d if you want to make sure it's not already a dir/file).. this will allow you to grap the country code from the query string.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^([a-zA-Z]{2})/blog/(.*) /blog/$2?ccode=$1 [L,QSA]
</IfModule>
You can ignore the country code also:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^([a-zA-Z]{2})/blog/(.*) /blog/$2 [L]
</IfModule>
Not sure if that will change something in WP (not sure how they process the url). You'll have to check.

Wordpress - pages stopped working - permalink issues?

I developed a simple wordpress site for a company.
Today they called me and said that some of the pages can't be visited.
So i checked it out , and seems like 3 menu options for apparent reason just stopped working. They said they haven't done any changes.
http://oi40.tinypic.com/ofqcev.jpg
Check the permalink it says says "projektledning" like it should be , and wordpress refuses to find the page.
http://oi40.tinypic.com/16h9mcg.jpg
And i tried for no reason to change the permalink and i've added "-1" to the link and bam its working...
What should i do to make the permalink work as the regular name it should be?
Try toggle permalink once under admin - settings - permalinks. Make sure you're server has write access to your .htaccess file before doing this.
.htaccess should look 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
At the last row, make sure there's a space between . and /
Also check your permalinks for any typos (spaces).
IF your url is foo.bar/something, make your .htaccess look like:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /something/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /something/index.php [L]
</IfModule>
# END WordPress
Hope this helps!

Forcing non-www url in Wordpress installation causes infinite loop

I am trying to rewrite http://www.domain to http://domain in a wordpress installation, but it looks like it's making the url loop from http://www to http:// and back to http://www, etc.
This is my htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
What's wrong with this code?
WordPress can do this for you. Remove the .htaccess stuff you've added, and go to Options -> General and change your site's URL.
It looks like you made changes to your .htaccess file that aren't necessary. To fix this problem change your .htaccess file back to default wordpress value which is:
# 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
Now that your .htaccess file is back to normal, login to your wordpress dashboard and click on Setting -> General. You'll see two text boxes labeled "WordPress address (URL)" and "Site address (URL)". Change the URL in both of these fields and you can remove the www part if you don't want that in your site URL. Save the changes and you're good to go! Here's a screenshot of the settings page so you can see the exact fields:
Hope this answers your question!

Resources