I have a blog on WordPress that was migrated from Blogger so have permalink structure like http://www.exeideas.com/2014/10/blogger-to-wordpress-best-htaccess-file.html but now I want to rewrite it as http://www.exeideas.com/blogger-to-wordpress-best-htaccess-file only.
I tried the following codes in my .htaccess file but nothing is happening.
## Remove /YEAR/MONTH/ From URLs ##
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/[0-9]{4}/[0-9]{2}/([^/.]+)\.html$ http://www.exeideas.com/$1/ [L,R=301]
</IfModule>
## Remove /YEAR/MONTH/ From URLs ##
AND
## Remove /YEAR/MONTH/ From URLs ##
RedirectMatch 301 ^/[0-9]{4}/[0-9]{2}/([^/.]+)\.html$ http://www.exeideas.com/$1/
## Remove /YEAR/MONTH/ From URLs ##
So can you explain the error behind my codes or anything else is happening...???
Simply remove the leading slash from your RewriteRule's pattern
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^[0-9]{4}/[0-9]{2}/([^.]+)\.html$ http://www.exeideas.com/$1/ [L,R=301]
</IfModule>
Related
I've tried going through the documentation for this but I'm definitely no sys admin. I'd like to create a ReWrite rule for my domain alienstream.com, so that alienstream.com/r/electronicmusic is aliased to alienstream.com/#r/electronicmusic
I know what the general form is going to follow
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^/([a-zA-Z0-9]+)$ /#/?var=$1 [L]
</IfModule>
but I just don't understand the syntax for this
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteRule ^(r/.+?)/?$ /?sub=$1 [NC,L,R]
We have a specific section of games called com_games. Could someone advise on how to rewrite url by adding parameter of & through htaccess so as have 301 redirect
From
http://www.abc.com/?page=4&option=com_games&view=list&Itemid=2
to
http://www.abc.com/?page=4&&option=com_games&view=list&Itemid=2
This needs to be achieve in all pagination pages, How to append & in the url for 301 redirection
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/\?(page=[^&]+)&([^&][^\s]+)\s [NC]
RewriteRule ^ %{REQUEST_URI}?%1&&%2 [R=301,L]
i have WP site, and i have this htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^mypage/ /z____articles/mypage/ [R=301,L]
</IfModule>
this makes redirection in my browser, but i dont want to redirect, i want that the page:
site.com/mypage/
showed the content of
site.com/z____articles/mypage/
i tried to use these flags [NC,L] or [L] but none of them works..
url: http://www.side.com/en/page-1/
I need to redirect to http://www.side.com/page-1/
How to do this using .htaccess file, maybe call php file and parse string( URI )?
You can do that with a simple rule:
RewriteEngine On
RewriteRule ^.*?/(.*)$ /$1 [L,R=301]
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteRule ^en/(.*)$ /$1 [L,R=301,NC]
I've been asked to redirect two pages to a different url. It's working except I get a trailing backslash at the end of the url due to the existing WP rewrite rules. I need to redirect these pages, but leave the WP rules intact for the pages that don't redirect.
Here are the existing WP rules:
# 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 want to add:
Options +FollowSymLinks
RewriteEngine on
Redirect 301 /*old url* http://*new url*/about.html
Redirect 301 /*old url* http://*new url*.com/tour.html
When I do this it redirects to:
new url.com/tour.html/
and the trailing backslash is causing the problem
I am a total .htaccess novice.
Thanks,
Matt
This is a case with mod_alias and mod_rewrite interfering with each other because they are both part of the URI-file mapping pipeline, so once mod_alias does its thing (the Redirect directives) and flags the URI to be redirected, mod_rewrite then does its thing and rewrites the URI. So at the end of the URI-file mapping pipeline, you've got a 301 redirect but the URI got mangled by mod_rewrite.
You can just stick with mod_rewrite instead and make it so the wordpress rules don't get applied at all. You also need to add your redirects before your wordpress rules, so before the # BEGIN WordPress add:
RewriteEngine On
RewriteRule ^/?old_url http://new_url/about.html [L,R=301]
RewriteRule ^/?old_url2 http://new_url/tour.html [L,R=301]