I created my first online site. I put all my files on the server (I used Wordpress for now) and it's great, but, when I enter my site address (let's say: www.mysite.com) I see only "Under construction". I only see my website after typing: www.mysite.com/index.php.
How can I make www.mysite.com load index.php without needing to enter it in the address bar?
There is probably an index.html file at the root of your public html folder that you need to delete. Once you delete this, your site will load as normal.
Most web servers load .html files before any other files. So if you have index.html and index.php in the root of your public html folder, it will most likely load index.html first.
You also may need to make sure you have an .htaccess file in the root of your public html folder, and that it contains the basic Wordpress code:
# 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
More info on that here.
Related
Actually I am running a Wordpress website with a simple template.
Now for SEO and Speed optimization purposes I would like to make a custom HTML page super simple and well optimized but that is not part of the Wordpress structure.
Basically, my own HTML page.
How can I have my Wordpress thinking the main page is that HTML created page as Main page and the rest of the website managed by the Wordpress ?
My answer requires an Apache or Litespeed server (and possibly others) with mod rewrite enabled, and where AllowOverride has not limited your use of .htaccess file.
See: https://codex.wordpress.org/htaccess#General_Examples
According to the WordPress documentation on that page, if you are using an .htaccess file to handle "pretty permalinks", then it creates and uses the following basic .htaccess file:
# 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
What this code does is redirect all requests that are not for an actual file or directory to the index.php file. You can modify this easily and achieve what you want. Simply changing it to something like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wp_index.php [L]
</IfModule>
# END WordPress
That change would redirect all requests to wp_index.php instead of index.php. So you would make that change, and then rename your index.php file to wp_index.php.
Once that is done, you can create a new index.php file and its contents can be plain HTML. Don't worry about the .php file extension. When somebody goes to your website, if they go to your homepage, the server will serve up the index.php file. For all other requests the server will use wp_index.php and WordPress will handle the request.
Please keep in mind that there are some differences in how .htaccess files work, depending on your server. If my changes don't immediately work, tweaking the .htaccess file contents may be necessary.
When I visit my site I see something like this:
Index of /
wordpress/
This is what file directory looks like:
.htaccess file:
# Do not remove this line or mod_rewrite rules and search engine friendly URLs will stop working
RewriteBase /
# 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
enter code here
What do I need to do so that when I visit example.com and I see the my wordpress site without the Index of / and list of pages?
The problem is that you do not have any index.php file in your public_html. When you get the directory listing, it is because there is not file inside that directory which matches the DirectoryIndex option. A typically WordPress website will include an index.php, so once you place the WordPress files there, that should go away. You could use Options -Indexes in the .htaccess file to hide that page, but that would give you a 403 error, and still not show your contents, so moving the content into the correct location is what you really want to do.
It appears that you may have placed your files into the directory you named "wordpress". If that is the case, try visiting http://example.com/wordpress/. If that is not what you were wanting, then just move the contents of "wordpress" into the public_html/ directory.
My web application url is something like http://www.example.com
Now i want that the end user will always see http://www.example.com in there
browser inseted of something like http://www.example.com/index or any thing after the / will not show to the end user
i.e http://www.example.com/abc.php?id='someid'
will display in the user browser as http://www.example.com
Thank You in advance and sorry for the bad english.....
There are several ways to do that. REST web service, URL shortening, changing the alias or creating an .htacces file.
An easy way to do that would be creating an .htaccess file in your root directory.
If you’re running Apache, you can do that by creating a redirect in your site’s .htaccess file. If you don’t already have one, just create a new file called “.htaccess” in your site’s web root.
Save this inside your .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
# Send would-be 404 requests to Craft
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>
That rewrite rule basically says, “If a request is coming in that doesn’t map to an existing folder or file, pass it along to index.php instead.”
source http://buildwithcraft.com/help/remove-index.php
and check this htaccess remove index.php from url
On root of my server, I have codeigniter with htaccess. I have created a wp/ folder along codeigniter's sub-folders (e.g. application, config) in which I have placed all the wordpress files. Now when someone types
www.abc.com
i redirect him to
www.abc.com/wp/
but I want to hide wp in the url. How can I achieve this without modifying my current file structure? I want wordpress to be my site's front and codeigniter to be my site's backend. The file structure is shown below:
In your root directory, create a .htaccess with following codes. This will map all your http requests to the /wp/ directory.
# ==>Initializaion…
Options -Indexes
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# ==>Without this line, your /wp/ directory may become visible sometimes
DirectorySlash Off
# ==>Map everything to your /wp/ directory
RewriteRule (.*) /wp/$1 [L]
You also want to hide the /wp/ directoy from URL. For this, create another .htaccess in your /wp/ directory and write following lines:
# ==>Initializaion…
Options +FollowSymLinks
RewriteBase /
# ==>Set default file
DirectoryIndex index.php
#==> If the requested resource is NOT a file, or the URL contains “/wp/” anywhere in it,
# then serve the default file instead
RewriteCond %{REQUEST_FILENAME} !-f [OR]
RewriteCond %{THE_REQUEST} /wp/
RewriteRule .* index.php [L]
If someone types “/wp/” anywhere in the address bar, they will not see what is in it. Instead, they will see your homepage.
You may have to adjust the code to suite your requirement.
I was handed down a project from another developer (who's not available any more and I cannot ask him for a solution) where he'd kept multiple codeignitor projects in a folder and called each of them through their respective index files.
The file structure - /var/www/html/{folder}/mobile_index.php
The mobile_index.php references a folder 'mobile' which resides in the same folder as mobile_index.php.
So the URL that I call is - "xx.xx.xx.xx/{folder}/mobile_index.html". This page opens fine but when I click on any link (e.g. user) within the page, this redirects to "xx.xx.xx.xx/user"
Now this page is blank and my error log says there's no page user in /var/www/html/user. But when i manually convert the link to "xx.xx.xx.xx/{folder}/mobile_index.php/user" this works and opens up the page. I think the folder is missing the .htaccess file but I have no clue what to include in that file, can anyone help me get the links working again?
This is what I have so far -
RewriteEngine on
RewriteCond $1 !^(mobile_index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /{folder}/mobile_index.php/$1 [L]
Options +FollowSymLinks
RewriteEngine On
#RewriteBase / #on server, uncomment this line by removing hash'#'
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* mobile_index.php?/$0 [PT,L,QSA]