Mobile app version of vmapp.org
Login or Join
Deb1703797

: How can redirect pages from old core PHP site to new Joomla site? We have our old site into core PHP and we have developed it again into Joomla 1.5 last year (because of some limitations

@Deb1703797

Posted in: #Htaccess #Joomla #Redirects #Ubuntu #Url

We have our old site into core PHP and we have developed it again into Joomla 1.5 last year (because of some limitations we have to build it into 1.5). Now the problem is the URL of sites changed as we have use SEO URLS on Joomla.

In between we have use .htaccess to redirect user from old URL to new like this

Redirect /pages/oldpage.php www.mydomain.com/products/category/new_page.html

Is this good practice to redirect user to new URL or not?(we have used same server).

One more thing, We have used splash page on our site, and to set up it we have made some changes and because of it one of the important link is not working, and it is
www.mydomail.com/index.php

How can I get rid of it? I have used DirectoryIndex splash.html home.html index.php in .htaccess to open splash page first when someone open my site mydomain.com.
Note: my website hosted on dedicated Ubuntu server.



EDIT: As mentioned I use Joomla and I have enabled SEF facility into it and it has already written .htaccess as per below (as I do not understand it much).

DirectoryIndex splash.html home.html index.php
RewriteEngine On

########## 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]

RewriteBase /
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]

Redirect /pages/oldpage.php www.mydomain.com/products/category/new_page.html .....................
.................

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Deb1703797

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ogunnowo487

Is this good practice to redirect user to new URL or not?


Yes, you will need to do this if you wish to maintain your search engine ranking and prevent any old links to your site from breaking. However, you need to use a 301 (moved permanently) redirect...

Redirect 301 /pages/oldpage.php ....


If you omit the status code then a 302 (temporary) redirect will be returned and search engines might not update their links.


www.mydomail.com/index.php # Returns 404 when accessed directly


(Note: The following is generic code for redirecting from /index.php to the bare URL /, if /index.php is not working (it exists but is returning a 404 when accessed directly) then there is possibly something else amiss that needs to be corrected.)

Again, you need to 301 redirect from /index.php to your domain root (presumably www.mydomain.com works OK?!). However, this might not be quite so straight forward if you have DirectoryIndex index.php as you could create an redirect loop as mod_dir will internally rewrite / to /index.php. However, this can resolved with mod_rewrite and specifically checking THE_REQUEST and only redirecting when it is a request from the client (HTTP) and not an internal rewrite.

Options +FollowSymLinks
DirectoryIndex index.php

RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /index.php HTTP/
RewriteRule ^index.php$ www.example.com/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


(In fact you should probably be redirecting from any directory index to the bare URL.)

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme