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.
Related
I am trying to make a page builder.
Each user must automatically receive a sub domain.
The idea is that the first folder is put behind the / to a subdomain.
Example:
I create a folder: example.com/user/main/main
and that it is automatically changed to:
user.example.com/main/main
If there is no folder but only an index or other page, this should not happen.
How can i can i do that? I want to make it with php or htaccess.
Thanks!
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
I have been searching and looking for the answer to this for SO long now without any joy, I hope someone can help.
Okay I have a web structure of:
Main folder - This is where you first land prior to logging in. After you log in you will be either directed to a number of websites that are resident in a sub-folder called websites. The problem I have is that I would like the document root, say the $_SERVER['DOCUMENT_ROOT'] variable, to default to the root of the website folder that it has been directed to. You see I have a lot of $_SERVER['DOCUMENT_ROOT'] in my php code and I use the '/' slash a lot in the href on my HTML tags.
I have seen that I could accomplish this by adding a .htaccess in the root of eiach website folder but 1, would like work for my situation and 2, could anyone please help me with the code. I understand I can use the RewriteRule command but I can't get my head around it. My folder stricture is like this:
login (index.html)
websites folder
website1 (index.html)
website2 (index.html)
website3 (index.html)
I have tried many versions of using RewriteCond etc but non of them work.
If anyone can help me out here I'd be very grateful.
Thanks
Nothing you can do in your htaccess file that's going to be able to change the document root. One thing that you can do is create separate domains that you can make their document roots point to each of the websites folders. Then proxy to one of those domains.
That way the URL on the browser doesn't change domain names, and internally, you're proxying requests back to yourself and the individual website domains will each have their own document root.
I want to block the direct access to directories in the www folder of my wamp server so that no one can directly access the files which are residing there.
Example:
There is a folder in www named "folder". This folder contains a file "page.php" and several images and css files. There is no index file in this folder. Now when the user enters ..../folder/ whole directory will be accessible to user. But I want to hide the directory list from user. But page.php should be accessible when opened through the any other page (via hyperlink)
Please help!
The way you describe it, you probably still want those items to be accessible so that pages referencing those files will still load. You just don't want Apache to list out the files when navigating to that folder.
Apache calls these pages "directory indexes". You can turn it off for a specific folder (and sub folders) by adding to the .htaccess file for that folder an entry:
Options -indexes
More details on the Options directive and .htaccess files here:
https://httpd.apache.org/docs/current/mod/core.html#options
I am developing local websites and keep having problems with wordpress sites when they use relative links such as:
<a href="/wp-content/themes/mytheme/myfile.php">
This resolves to my localhost document root (htdocs) instead of the root of the job (htdocs/myjob).
Is it possible to use an .htaccess file in the root of the job (htdocs/myjob) folder to "fix" this behaviour? Or is it possible to put this htaccess file in htdocs, check the HTTP_REFERER, and send the browser to the correct site root?
Can you show me an example of the rewrite rule needed?
Any other suggestions would be welcome too.
In fact you mean absolute links. Relative links are what you want.
You should be able to configure the root directory in your Wordpress setup: this would be the correct approach.