I would like users that go to the website 'http://kevingstongramado.p.ht/',
to be redirected to 'http://kevingstongramado.p.ht/catalogo/'. Which is in fact a wordpress website.
I´ve tried this:
Redirect 301 /http://kevingstongramado.p.ht/ http://kevingstongramado.p.ht/catalogo/
Putting the .htaccess inside the root directory of the website. Not the root directory of the folder which contains the wordpress.
Doesn´t work.
"catalogo" is the folder which contains the 'index.php' that opens the wordpress website.
Anyone?
Use RedirectMatch
If I am not wrong, you should use the relative path.
Create the index file index.htm in your root folder. Then,
RedirectMatch 301 /index.htm /catalogo//$1
.htaccess files are calculated by searching and interpreting the configuration for every .htaccess file in every directory in the path under the document root.
You want something along the lines of
RewriteCond ${REQUEST_URI} !^/catalogo/ [NC]
RewriteRule ^(.*)$ /catalogo/$1 [L]
This makes the rule conditional. It will only execute the rule if /catalogo/ is not present in the request uri. And the actual rule says to take everything and put /catalogo/ in front of it... and that it is the last rule to be executed in the file. This file will be reprocessed when it goes to the /catalogo/ directory.
Related
I have wordpress installed on my root folder directory files are like public_html/wp-admin, public_html/wp-content etc..
I want it when my site "www.example.com" is visited it will read another folder in the subdirectory eg (public_html/showhomepage)
where showhomepage has a static index.html with css, images etc
Is this possible?
In your wordpress/index.php:
header('Location: showhomepage');
Or you can set up a rewrite rule in your .htaccess file:
RewriteCond %{DOCUMENT_ROOT}/index.php !-f
RewriteRule . /showhomepage [L]
Or something along those lines. Apache has good on mod_rewrite and there's plenty of supporting sites to make some of the explanations more clear.
I may be mistaken but, that redirects requests to your site to showhomepage. I'm not an expert at rewrite rules but I think you can suppress the path with REQUEST_FILENAME in your rewrite conditions.
Is it possible to redirect a directory and all its sub-directories to another location with a single redirect rule within wordpress´ htaccess file?
e.g.
http://example.com/old
http://example.com/old/foo
http://example.com/old/foo/bar
move them all to
http://example.com/new
--
when I try this
RedirectMatch 301 ^/old/(.*)$ /new/
while pointing to
http://example.com/old/foo/bar
it ends up with
http://example.com/new/bar
You can put this rule in your htaccess (before Wordpress' main rule, after RewriteEngine On line)
RewriteRule ^old(/.*)?$ /new [R=301,L]
Note: you may have to clear your browser cache since your old rule is stored into it
How do i edit the .htaccess file to redirect all links in a subdirectory to another subdirectory
inactive url
http://example.com/dir/archive/AnythingHere
redirect location
http://example.com/dir/new/
You can use this code in your DOCUMENT_ROOT/.htaccess file:
RewriteEngine On
RewriteRule ^dir/archive/(.*)$ /dir/new/$1 [L,NC,NE,R=302]
Make sure to place this rule as very first rule in your WP .htaccess file
I have files with this pattern :
(a[0-9]+\.htm)$
Considering file names a1180717200.htm or a1245862800.htm : normally they would be in root for the domain I am working with. Instead they have been moved to a new directory /archives so the files are now in :
thedomainiamworkingwith.com/archives/a1245862800.htm
I have tried a few things but I have no success. The root is occupied by a working wordpress site, with its normal .htaccess file set up. So I need to know what the redirect or RewriteRule would be, as well as how to put it in the .htaccess file without messing up the current wp install.
Are you trying to redirect your pages of this pattern to archives directory?
You can try something like this
RewriteRule ^(a[0-9]+.htm)$ thedomainiamworkingwith.com/archives/$1 [R=301,L]
A site I'm designing a website for was built with static HTML files. I'm converting it to WordPress but I need the old site to still function while WordPress is installed in the same directory (e.g. have index.html be the default one and then have WordPress be something like indexNew.php)
So they go to http://domain.com/indexNew.php to see updates to the new website until it's finished.
How would I configure that in the .htaccess file?
You can use a .htaccess with a simply rule to redirect users to index.html except you :
RewriteEngine on
RewriteCond %{REQUEST_URI} !/index.html$
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123
RewriteRule $ /index.html [R=302,L]
Replace 123.123.123.123 by your public ip adress.
You should use your .htaccess to set the default document order:
Tired of having yoursite.com/index.html come up when you go to yoursite.com? Want to change it to be yoursite.com/ILikePizzaSteve.html that comes up instead? No problem!
http://www.javascriptkit.com/howto/htaccess6.shtml
In your case, you won't need to rename the index.php at all - this will do the trick:
DirectoryIndex index.html index.php
Anyone who requests yoursite.com will see the content from index.html. To see the new Wordpress content, just navigate to yoursite.com/index.php