I have a Wordpress website with permalinks with post name. Now I have a new template on a specific page that uses files from exactly the same url path, and I can't change that.
How can I make Wordpress access my requested page (example.com/meniu/) and ignore the folder name with same name? (example.com/menu/swf/)
Thank you!
This is my .htaccess. How can I add exclusions?
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /club/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /club/index.php [L]
</IfModule>
You could prepend another rule to exclude only that directory:
RewriteCond %{REQUEST_URI} ^/menu
RewriteRule . /club/index.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /club/index.php [L]
Related
I am converting my old site on wordpress and I don't want to loose any of the indexed "juice" as the old site has been going for 2years or so.So i have to make the same url.In my wordpress site i want to add .html at the and of my URL. I am using a plugin thats adding .html to all pages.
but its not adding .html on my product page.I want to add .html to all of my urls.
It has been suggested to us to use .htaccess rules to solve the problem, but we do not know where to start.
here is my wordpress site url.
http://www.fearfashion.com/
My full htaccess 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
Any help would be appreciated.
You can try a rule like this to force redirect non .html URLs to .html:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !\.html$ [NC]
RewriteRule ^(.+?)/?$ $1.html [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I'm using two different opensource systems for a customer.
On the main directory I've installed wordpress.
In a sub directory (/shop) I've installed OpenCart 1.5.5
I want to have SEO url's enabled in OpenCart but when I enable this, my url becomes:
www.example.com/shop/category
The main htaccess from wordpress then checks if it knows the category and the post in wordpress and returns a 404.
If someone has got a solution for me I would be very pleased!
Thank you for your effort!
HTACCESS from Wordpress:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
HTACCESS from opencart:
Options +FollowSymlinks
Options -Indexes
<FilesMatch "\.(tpl|ini|log)">
Order deny,allow
Deny from all
</FilesMatch>
RewriteEngine On
RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteRule ^download/(.*) /index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
change the RewriteBase directive in the OpenCart .htaccess to
RewriteBase /shop/
Not sure if this works as I don't have a way of testing this locally. Change Wordpress htaccess to this:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} !^/shop
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
i have installed the wordpress inside the domain with in a folder name, questions, landing page is working fine, no other links working, its say page not found. what to do ??
Using .htaccess like
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . questions/ [L]
Its running the index.php page only. any help ?
Looks like you'll need rewritebase as you have an htaccess on your parent folder
RewriteEngine On
RewriteBase /questions/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /questions/ [L]
Are you putting this on a subfolder of the root of the site called /questions?
if yes, I think you'll need to change
RewriteRule . questions/ [L]
to
RewriteRule . /questions/ [L]
or try this instead of rewritebase
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /questions/ [L]
</IfModule>
/custom/player-registration.php
I've used the following .htaccess in my WordPress install and I can't access the above URL... any tips? I've tried 2 methods here... The URL continues to go to a WordPress search page.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^custom - [L,NC]
RewriteCond %{REQUEST_URI} !^/(custom|custom/.*)$
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
UPDATE
I suppose I need to clarify that I am able to access /custom but am NOT able to access files within that directory... how do I access files within that directory?
Default WP .htaccess:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
means: if request doesn't point to any existing file or directory, use index.php
So it should serve Your file well with default settings. What are You trying to acomplish with the rest of Your file?
Try
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^custom.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I tried to do this in many ways, but I really cannot exclude directory "progress" from wordpress rewriting rules in .htaccess. I found many solutions but none of them seems to be working.
.htaccess in root directory of wp contains:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I tried to use
RewriteCond %{REQUEST_URI} !^/(progress/.*)$
and
RewriteRule ^progress($|/) - [L]
and
RewriteCond %{REQUEST_URI} !^/?(admin|progress)/
and I even tried to put Alias /progress /home/website/progress to httpd.conf but it still not working properly. Surely, mod_rewrite is installed and working, it redirects me to index.php that shows 404 error when I trying to access the directory...
From here.
#Change
RewriteRule . /index.php [L]
#to:
RewriteRule ./ /index.php [L]
Both of your attempts should work when used correctly. As the rules are tested sequentially, you need to put the exceptional case in front of your existing Wordpress rule:
RewriteRule ^progress($|/) - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Or when using the additional condition (well ok, here the order of the conditions does not matter as they all have to be fulfilled):
RewriteCond %{REQUEST_URI} !^/(admin|progress)/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Does the directory progress actually exist? What's inside it?
Where are you placing the code you have provided within the context of the .htaccess?
The line RewriteCond %{REQUEST_FILENAME} !-d will mean the rewrite rule is ignored if the request translates to a real directory.
Instead of following on .htaccess
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Use the folder name that you want to exclude from wordpress htaccess rule as RewriteBase, so basically try writing following in .htaccess file for the folder "FOLDER_NAME"
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /FOLDER_NAME
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
And place this .htaccess file into the folder with name "FOLDER_NAME". Please let me know if that works.