I have wordpress setup to change the admin url to www.mydomain.com/admin. But now I have updated the permalinks to use the post name instaed of the id I get a redirect loop when I try to access the admin page. The problem is with the extra rules wordpress asked me to add to the .htaccess but I am unsure how to change it to allow both rules.
Wordpress 3.5.2 rewrite rules as below.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
RewriteRule ^admin/(.*) wp-admin/$1?%{QUERY_STRING} [L]
Anyone know what i need to do to allow both rules?
Was trying out a few solutions and it would seem that having the rewrite rule for changing the admin url to www.mydomain.com/admin BEFORE the mod-rewrite rules is the key to allowing both rules to work together. See updated/fixed .htaccess code below.
RewriteRule ^admin/(.*) wp-admin/$1?%{QUERY_STRING} [L]
<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 have an issue with WordPress. The site working pretty normal but on the admin panel, various pages like edit post, installed plugins, add new plugin, add new page, settings redirects me to homepage. I'm googling like crazy for 3 days but i just found the mod_security issue. And it turned out useless for me too.
here is my .htaccess file
RewriteEngine On
RewriteBase /
RewriteCond /home/gokkur/public_html/wp-content/sitemaps%{REQUEST_URI} -f
RewriteRule \.xml(\.gz)?$ /wp-content/sitemaps%{REQUEST_URI} [L]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
SecFilterEngine Off
SecFilterScanPOST Off
this is default content of WP .htaccess file:
# 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
Maybe your custom rewrite rules generating problems.
I'm using wordpress for a site,
this url before tes.com/index.php/about/
i want url like this tes.com/about/
I have tried copying parts of WordPress' .htaccess, however shows a 404 error.
My .htaccess file looks like:
# 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 ideas on where to start and how to accomplish what I'm looking for?
Go to your WP-ADMIN-->Settings-->Permalink and use the permalink structure change there, if it generate any .htaccess file copy the content and update your .htaccess file.
Or Check if your hosting mod_rewrite is enable by creating a file phpinfo.php with content,
Upload this file and browse via Browser. So you know which modules are enabled. You need mod_rewrite enable to remove index.php from URL.
Try this -
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /test.com/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /test.com/index.php [L]
</IfModule>
The official instructions will give you clean urls. So best to follow this
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
I am trying to redirect using a .htaccess file and it's not working. The syntax seems to be correct. Does any one have any ideas what is incorrect?
# 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
Redirect 301 /www.easycovertarp.com/ http://www.aeroindustries.com/products/easy-cover/
Insert this rule just below RewriteBase line:
RewriteCond %{HTTP_HOST} =local.aero.com
RewriteRule ^/?$ http://www.aeroindustries.com/products/easy-cover/ [L,R=301]
Ordering is important in mod_rewrite rules so this rule must be placed above shown WP rules.
I have a site running on Wordpress. I also have a couple of custom pages running in subfolders. My issue is that my existing rewrite rules no longer work when using permalinks in Wordpress. I have the following in my htaccess:
RewriteEngine On
#Wordpress
<IfModule mod_rewrite.c>
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
#Custom
RewriteRule ^e/booking/(.*)/(.*)/$ /events/booking.php?event_id=$1&hotel=$2
RewriteRule ^e/(.*)$ index.php?url_friendly_name=$1
it may be an obvious question, but I don't know how to make my custom rewrites work with wordpress?
Say I have a site mysite.com, which is a wordpress site.
I already have the following rewrite rules to remove index.php:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
if I go to mysite.com/?blog_type=a-blog-type I get the proper page with only the blogs of that type
What I would like, is for the user to be able to type in mysite.com/blogs/a-blog-type/ and have that acutally do the query, but keep on displaying /blogs/a-blog-type/
I've looked at many similar answers on here, but most seem to make it so that it just redirects from the query, to the pretty url, which I don't want, as the pretty url just leads to a 404 error as it's not doing the query.
Thanks for the help.
This rewrite rule will take any mysite.com/blogs/a-blog-type/ URL and rewrite it to mysite.com/?blog_type=a-blog-type. So mysite.com/blogs/a-blog-type/ would be displayed to the user, but mysite.com/?blog_type=a-blog-type will be loaded.
RewriteRule ^blogs/([^/]*)((/)?)$ ?blog_type=$1 [nc,l]
EDIT: So here's how your config will now look:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^blogs/([^/]*)((/)?)$ ?blog_type=$1 [nc,l]
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>