Rewrite files from sub directory to main directory in Joomla
I am trying to rewrite the files from the sub-directory www.mywebsite.com/renew (where I built the site) to the main directory www.mywebsite.com (now that I have completed my updates).
I have moved the files from the /renew directory into the main. Re-written the .config file and the .htaccess file so that when you go to www.mywebsite.com the correct index page displays, however, when you click any link it points to the sub-directory again in the address bar (ie. http://www.mywebsite.com/renew/books-products.html).
Does anyone know how to fix this?
Code:
#
# @version $Id: htaccess.txt 13415 2009-11-03 15:53:25Z ian $
# @package Joomla
# @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##
#####################################################
# READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options +FollowSymLinks' may cause problems
# with some server configurations. It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file. If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's. If they work,
# it has been set by your server administrator and you do not need it set here.
#
#####################################################
## Can be commented out if causes errors, see notes above.
Options +FollowSymLinks
#
# mod_rewrite in use
RewriteEngine On
RewriteBase /renew
#### Begin http://www.divanyoung.com/rewrite-root-directory-subdirectory.php
#
# Add trailing slash if path does not contain a period or end with a slash
RewriteCond %{REQUEST_URI} !(\.|/$)
RewriteRule (.*) http://www.divanyoung.com/$1/ [R=301,L]
#Change http://yoursite.com to http://www.yoursite.com (Optional)
RewriteCond %{HTTP_HOST} ^divanyoung.com$
RewriteRule ^/?(.*)$ http://www.mywebsite.com/$1 [R=301,L]
#Rewrites http://www.divanyoung.com/renew to http://www.divanyoung.com/
## Added this to allow existing files and directories to work
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
## Now the rewrite of subdir to rootdir
RewriteCond %{REQUEST_URI} !^/renew
RewriteRule ^(.*)$ renew/$1 [L]
#RewriteBase /
## Begin http://www.drichproductions.com/random-knowledge/rewrite-root-directory-subdirectory.php
#
# Add trailing slash if path does not contain a period or end with a slash
##RewriteCond %{REQUEST_URI} !(\.|/$)
#RewriteRule (.*) http://yoursite.com/$1/ [R=301,L]
#Change http://yoursite.com to http://www.yoursite.com (Optional)
#RewriteCond %{HTTP_HOST} ^yoursite.com$
#RewriteRule ^/?(.*)$ http://www.yoursite.com/$1 [R=301,L]
#### Rewrites http://www.yoursite.com/subdir to http://www.yoursite.com/
## Added this to allow existing files and directories to work
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
## Now the rewrite of subdir to rootdir
#RewriteCond %{REQUEST_URI} !^/joomla
#RewriteRule ^(.*)$ joomla/$1 [L]
#########End - Rewrite
########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
## Deny access to extension xml files (uncomment out to activate)
#<Files ~ "\.xml$">
#Order allow,deny
#Deny from all
#Satisfy all
#</Files>
## End of deny access to extension xml files
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [F,L]
#
########## End - Rewrite rules to block out some common exploits
# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root)
########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section
You have moved the files from /renew to your main site. However, you have not change the link in your code. You will have to change the link like books and products still forwards to your "domain/renew/bookandproducts".
You have moved the files from /renew to your main site. However, you have not change the link in your code. You will have to change the link like books and products still forwards to your "domain/renew/bookandproducts".
Where in the code do I need to make the updates. How should I change the current links?
You have moved the files from /renew to your main site. However, you have not change the link in your code. You will have to change the link like books and products still forwards to your "domain/renew/bookandproducts".
That doesn't work - because this is coming from the menu items. So if Joomla has called on the database to find the article that I want for the to be for this menu item and all of the files are now in the main directory then how come it's not requesting it from the main and not from the sub-directory.
As you know for menu items in Joomla you do not place a html link in. Am I missing something? Thank you for your help! I am so frustrated with this. :-)
Bookmarks