I want to create a copy of my currently running codeigniter website, say http://www.example.com and place the copy in a new subdomain "beta", say http://beta.example.com for test purposes and site modifications, so that the live site doesnt gets unmanaged due to the modifications.
So its about making a replica of website for test purposes and modifications under beta subdomain. How should I do it?
This is the file-structure I am having in beta subdomain
Use this htaccess file in ur main directory
for url like www.website.com
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php/$0 [PT,L]
for your testing link like www.website/test use the following code
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /test/index.php/$0 [PT,L]
First use your cpanel to add a new subdomain: http://documentation.cpanel.net/display/ALD/Subdomains . While adding the subdomain you will have to enter its document root path.
If your website uses a database, then you need to create a new database using MySQL Databases option in cPanel. After creating a database and assigning a user to it, open phpMyAdmin, go to the original database, go to Operations tab in phpMyAdmin and copy that database to the new database you created.
Open File Manager and copy all the files related to your main website. Paste them in the subdomain's document root.
If your website uses a database, you will have to finally modify the database connection parameters in your site code. You can find the location of config easily through a grep command:
grep -r "mysql" /public_html/subdomain/
Now when you open http://beta.example.com you should see the replica website.
Related
I have read the doc from Yii2 official website to deploy yii2 into share host from this : http://www.yiiframework.com/doc-2.0/guide-tutorial-shared-hosting.html, and about discussion on this : stackoverflow.
So, I decide to use sftp to upload the yii2 folder.
And this is the list of directory in my share host.
access-logs
etc
logs
public_ftp
public_html
ssl
www (this is a link folder to public_html)
You know, because the share host can hold on domains untill 5 domains,
is it possible to upload yii2basic folder into public_html folder ?
So the result like this :
access-logs
etc
logs
public_ftp
public_html
-basic
- bunch of yii folders here
ssl
www (this is a link folder to public_html)
Because now, if I want to access my web, I have to write like this : mydomain.com/basic/public_html/index.php
I need like this :
mydomain.com/index.php
Please guide me.
Yes you can upload it inside the public_html folder but the only problem that I have been facing nowadays with yii2 basic app is the pretty URLs, you can clone or upload entire contents inside the public_html folder, what I did is as follows only the difference is I have a web folder instead of www
directory structure
public_html
assets
commands
config
controller
mail
migrations
models
runtime
tests
vendor
views
web
public_html/.htaccess
<IfModule mod_rewrite.c>
Options +SymLinksIfOwnerMatch
RewriteEngine On
</IfModule>
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_URI} ^/.*
RewriteRule ^(.*)$ web/$1 [L]
RewriteCond %{REQUEST_URI} !^/web/
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ web/index.php
</IfModule>
public_html/web/.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
this works but in the URL it shows /web/index.php?r=site/index and as soon as I turn the prettyUrl on in the config file urlManager it would only show default index page and every link I try to open ends up on the home page view although the URL in the address bar is correct and urlManager parses the rules correctly, this is as far as I have gone.
If you don't mind bunch of Yii 2 folders in your root folder just place all basic template folders (except web) and files in the root folder. Then place the content of web folder in the public_html folder.
It should be something like:
access-logs
assets
commands
config
controllers
etc
logs
mail
models
public_ftp
public_html
// here should be the content of web folder of Yii 2 basic app
runtime
ssl
test
views
widgets
I have a domain that works like a charm www.mydomain.com. Recently I wanted to add a subdomain like myotherweb.mydomain.com, so i add my subdomain from my cPanel and upload my Wordpress (works on XAMPP) to subdomain directory.
After that I try to open myotherweb.mydomain.com; the result is a blank page.
So I try to open myotherweb.mydomain.com/wp-admin and the Wordpress login page shows up, and I can log in to my wp-admin dashboard page. But when I try to edit a page, the edit page is blank.
What is happening in this case?
Probably this case happens if transfer of wordpress is not proper or .htaccess is not proper set.
.htaccess settings for subdomain
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]
For more reference you can check on Wordpres Codex htaccess
Transfer wordpress from one domain to another
This is most common problem happens to many when transfer from one domain to another.
Update Your wp-config.php File
define('WP_HOME','http://myotherweb.mydomain.com');
define('WP_SITEURL','http://myotherweb.mydomain.com');
Update urls in sql
For this open your exported database in text-editor like notepad+, sublime or netbeans, and do find and replace urls mydomain.com to myotherweb.mydomain.com and try import on live again,
or if you are not familiar with this or this is boring task for you then you don't need to panic, there is one plugin available to do this task for you very easily.
Install Wordpress duplicator plugin in your xampp and use as instruction given on plugin site or this reference site, after that upload new wordpress site generated by plugin on your subdomain.
Hope it will work for you.
I have solved this problem by install wordpress from my cPanel, and copy this setting from new Wordpress installation wp-config :
AUTH_KEY
SECURE_AUTH_KEY
LOGGED_IN_KEY
NONCE_KEY
AUTH_SALT
SECURE_AUTH_SALT
LOGGED_IN_SALT
NONCE_SALT
then replace my Wordpress project wp-config, and it's magic.
I don't know why it's necessary.
I want to install my ZF2 application on a VPS server without support for Virtual Host. I´m using a simple application based on ZendApplicationSkeleton.
I´m using the default .htaccess:
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
All solution I´ve found in SO does not work for me. They may fit ZF1, but not ZF2:
Link 1
Link 2
Link 3
Link 4
My application is in a folder named /var/www/html/testapp.
The main page is loaded once I typelocalhost/testapp/public on the browser. Also my module is loaded if I type localhost/testapp/module, but navigation does not work.
Ie: in the main page, I´ve created a button like:
Go To Module
But if I click on it I navigate to localhost/login/index showing Not Found, not to the correct module/index.phtml page.
Help appreciated with that.
Your problem has nothing to do with server configuration. Since your app is in a sub-folder, the link is wrong. It would need to be something like
Go To Module
for it to work. However, public/ should never appear in you URLs. With things setup this way you are allowing users to view files outside your app's web root, which is a potential security risk (and results in ugly URLs).
The solution to this is to setup a separate vhost for your ZF2 app, which has a DOCUMENT ROOT pointing at the app's public folder. If you are having problems with this, post that as your question; or if you can explain why this isn't possible perhaps we can advise further.
I'm new with codeigniter and right now I'm trying to migrate a codeigniter application to another server. This application was in another server and now I want to move it to another server. In this server I have also a wordpress website and it works perfectly.
Firstly, what I have done it's a backup from the mysql database and from the files and I have move them via ftp to the another server under the /inventarios folder, so if I wrote on my browser
http://xxxxxx.com/inventarios
I should see the codeigniter application but what I receive it's a 404 error with the Wordpress interface
I have change the database.php and the another files from the config folder and it doesn't work. Why?. Under the inventarios folder I don't have a .htaccess file. Could you help me,please?. Thanks and let me know if you need more details.
EDIT 01
The htaccess which I have in the root folder is this:
# 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 don't know if inside of inventarios I should place another htaccess.
Thanks so much
Create sub-folder with name of inventarios in root of your host. Inside the folder upload all your CI folders(application, system, index....).
Then go to application/config/config.php
$config['base_url'] = 'http://xxxxxx.com/inventarios';
Also /application/config/database.php is to be edited
application/config/config.php
application/config/database.php
Don't forget to update .htaccess in root if there're some updates or url redirects to old domain/url
I have a website abc.com were i have kept all my files and folders. Now I have created a folder called "newsite" and moved all the files over to there. Now i want if my user type abc.com in browser it will automatically redirect them to abc.com/newsite
I am using a linux server with godaddy hosting. I know this can be done through htaccess file. Can anyone help me on this?
I am using this in htaccess file but this does not work
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.abc.com$
RewriteRule (.*)$ /newsite$1 [R,L]
</IfModule>
Thank you so much in advance
This should do it:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/newsite [NC]
RewriteRule ^ /newsite%{REQUEST_URI} [R=301,L]
The RewriteCond checks if the URL starts with /newsite if not it will redirect the user to it.
Try this solution:
RewriteRule ^xxx/?([^/].*)?$ old/xxx/$1 [L]
Or
RewriteRule ^(.*)directory(.*)$ $1otherdir$2 [QSA,L,R=301,NC]
Hey friend, is correct:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/yournewfolder [NC]
RewriteRule ^ /yournewfolder%{REQUEST_URI} [R=301,L]
Only this in your .htacces that is within your public_html folder (root of site)
The new folder is the folder that contains the files of your website. If you use wordpress, use Softaculous to clone the entire content of your site to the new folder.
Remember that you will have to change the information for your database. - Log into your phpMyAdmin account, export your database to a location on your computer (use the option Custom - display all possible options to export and maintain a backup of your database exported - if you miss something, you will have this insurance file to import it again).
Then open your yourdatabasename.sql file on your php editor, use the replace option and make the following change.:
EX: yoursite.com
(Replacing option to) yoursite.com/yournewfolder
save the edited file. Now go back to your phpMyAdmin account and delete your old database (Selecting all tables and using the delete option), after deleting, go to the Import option and import your new database already edited.
Have a great day.