How to setup my .htaccess file to find my index.html? - .htaccess

I had a wordpress installation on my website : www.kud-ivancice.hr, I deleted the files, and droped the tables, and then copied my new website on the server. I edited my .htaccess, deleted the wordpress code and now it states : DirectoryIndex index.html, but when i try to open the page, it doesn't work. This is the first time I'm doing this, and am feeling quite lost. Any tips?

Related

How to make the .htaccess file work bypassing the browser cache?

I'm creating a website, and I wanted to upload a new version to the server. The problem is the .htaccess file.
I changed the file structure. Previously, I had an app folder with index.php in it, and .htaccess automatically removed the ending to make the url look like www.sitename.com/app.
Now app is app.php file, and same .htaccess removes .php to make the url look the same as before.
For users who have visited the site before, the redirection will not work, because it seems that the browser's cache is blocking them (after deleting everything works as it should). I'm still fairly new to web development, so is there any option to prevent this?

new to .htaccess, how to redirect specific page to mainpage

I'm new to .htaccess file.
My site is hosted on 1and1 and by default it shows www.mydomain.com/defaultsite when nothing is uploaded to my account. Now I've uploaded my wp site and have managed to make it go to index, but if someone inputs in the url www.domain.com/defaultsite he will still get the wrong place.
How can I manage this issue with .htaccess file so that any request to defaultsite will take the user to www.mydomain.com ?
I'm not a 1and1 user, but this could be a DNS cache issue. First, check your document root for the presence of a directory called defaultsite. If it exists, remove it. If not, then you can attempt removing it using mod_rewrite. Insert this rule immediately after RewriteEngine On in your .htaccess file:
RewriteRule ^defaultsite/?$ http://yourdomain.com/ [R=302,L]
If it's working for you, you can safely change 302 to 301 to make in permanent and cache-able.
I have also seen comments referring to an index.html file in the document root. If you see one, delete it - it could be that, internally, 1and1 maps defaultsite to index.html.
Also, it will help for you to clear the cache in your browser when testing. If using Chrome, you can open the Developer Tools (Ctrl+Shift+I), click on the settings cog at the top right of the panel that opens, and check 'Disable cache (while DevTools is open)`.
I had a similar issue and was pulling out my hair trying to figure this out. 1&1 is hosting while Namecheap holds my domain. I was able to access my page without /defaultsite on Safari and mobile Chrome. But on desktop Chrome I was being redirected to /defaultsite.
To remedy this I cleared my cache, flushed my DNS cache, and cleared my browsing history. Not sure if the latter 2 were necessary but having done all three it did help resolve this issue.

Is it possible using .htaccess file to keep / and all links in a subfolder?

I have a website example.com with a subdirectory of example.com/admin/, I want to put a .htaccess file in my /admin/ directory so that if I create a link like this Home that it will stay in example.com/admin/ and not go to example.com/.
I know I could just do Home, but want an over all solution where I don't have to do that to all links, encase at a later time I decided to rename the /admin/ directory.
You can not do that with .htaccess. Because it is not on the server that it happens, but in the browser.
But it is possible to redirect some pages, If it is possible to recognize them, for example by name.
You can redirect all admin-xxxx.html pages to admin/admin-xxxx.html

How to STOP redirecting my website to mobile.mywebsite.com in smartphones

I have developed a website www.mywebsite.com and it is ready to go live.
I have used Codeigniter framework.
When I enter www.mywebsite.com from any android/iphone, it redirects automatically to mobile.mywebsite.com and displays page not found error. I dont have any mobile site developed for this. I want to show the main site even on the smartphones.
I am not good at .htaccess file, and I am using default .htaccess to remove the index.php in the url.
I tried creating a subdomain mobile.mywebsite.com and pointed to root path. But same response. I search online, but didnt find anything on how to STOP redirecting.
Thanks in advance.
When I was uploading my local files into the server I was NOT overwriting the old ones assuming the folder is clean and no need to overwrite. But my hosting provider has default .htaccess which is redirecting to the mobile site.
I deleted the old one and gave my .htaccess without the mobile redirection and everything is in place now

Redirection from index to front page (.htaccess)

I installed Drupal on my website. It works perfectly but to reach the front page I'm systematically redirected to a page called "Index of" and I have to click on the subfolder drupal-7.12/ to reach the front page. So, the real url for my website i guess is
http://www.mysite.com/drupal-7.12
On my ftp server is organized like this:
Folder public_html
-> Folder drupal-7.12 + a file .htaccess
There is another .htaccess file inside the folder drupal-7.12
I know that I have to modify one of them but i don't know which one and what i have to modify ?
I hope that someone will understand my problem and could help me
Thanks
ML
I would suggest that you remove the folder in drupa.7.12 and move everything up one directory. Basically you are set up as:
Mysite/drupal7.12
move all the contents of drupal 7.12 up one directory to your public_html folder
Or you need to edit the htaccess in the public_html folder to redirect you to that folder. But that is going to cause some issues in the long run.

Resources