Server always adds suffix to url - linux

I was playing around with wordpress on my linux machine, and now I am stuck as when i call the ip address on any browser xxx.xxx.xxx it always gets redirected to xxx.xxx.xxx/wordpress which was a directory below /var/www/html/ where i put all the wordpress files. I must somehow damaged my httpd conf / .htaccess or anything in between. I am not very experienced in those areas, thats why I ask you guys.
How can i disable the permanent addition of a suffix to my systems default url?
Thanks in advance

Is there any Virtual Hosts added to your httpd conf. If yes try removing it

Related

Nginx .htaccess doesn't work in linux server

hi everyone i have just created website to myself and i editted links using .htaccess (111.111.111.111/list.php | like 111.111.111.111/list ) not include php extension. but when i put files into my linux server, it doesn't work my linux nginx server. when i write 111.111.111.111/list on the url box, it display 404 not found page. it wants to me write 111.111.111.111/list.php
and everything is working on my computer localhost. (i didnt buy domain name i just use only server's ip) please help me
by the way i apologize for my english.
Nginx does not support .htaccess-files because of performance reasons.
https://www.nginx.com/resources/wiki/start/topics/examples/likeapache-htaccess/
You have to do this inside of the nginx configuration file.
To remove the .php maybe this helps:
How to remove both .php and .html extensions from url using NGINX?
If you really need .htaccess, you have to use apache instead of nginx.

CentOS 7 Apachect1 Removing a Virtual Host

[SOLVED]
I have a CentOS 7 VPS running Apachect1 and I have just finished a project that required me to create multiple subdomains. Now that I am done I do not need them so I want to go back and clean up a bit.
I had originally created the files
/etc/httpd/sites-available/site1.domain.com.conf
/etc/httpd/sites-available/site2.domain.com.conf
/etc/httpd/sites-available/site(...).domain.com.conf
and
/etc/httpd/sites-enabled/site1.domain.com.conf
/etc/httpd/sites-enabled/site2.domain.com.conf
/etc/httpd/sites-enabled/site(...).domain.com.conf
They were working and everything and all I thought I had to do to remove these domains were to delete those files and restart apache. I did this but I can still access these websites. Any idea?
I ran these commands:
# apachectl restart
# systemctl restart named.service
# systemctl start named
# systemctl enable named
# systemct1 status httpd.service
I have even restarted my server but nothing. Sorry if I missed anything obvious, I am still new to Linux. Thank you for any help.
there are several things you can do.
the first thing is to verify /etc/httpd/conf/httpd.conf to make sure how VIRTUAL HOSTS are defined in you file and if there are declared there.
Centos httpd config file
If there are no VIRTUAL HOST THERE. you will need to make sure that those files do not exist
/etc/httpd/sites-available/site1.domain.com.conf
/etc/httpd/sites-available/site2.domain.com.conf
/etc/httpd/sites-available/site(...).domain.com.conf
You could also try this commands
service httpd stop (to stop service)
service httpd start (to start service)
Let me know if this works :)
SOLVED
So I figured out how to work around this. I am not sure why but the issue was, anytime I went to a non existing subdomain I would get redirected to /var/www/SubdomainA/index.php
The way I worked around this was I went to each of my subdomains and added a rewrite condition in the .htaccess file that said, if the subdomain is not the specified subdomain, then send it to the main site.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www|SubdomainA)\.example\.com
RewriteRule .* http://www.example.com%{REQUEST_URI} [R=301]
Hopefully this will help someone at some point.

Can't access files on Magento root

I am looking to install an SSL on my domain name and in order to do so I need to upload a .htm file to the root and access it via the browser, but when I do so, I keep getting a 404 error - this is with any .html page on the root - nothin shows up.
I have edited my htaccess file as well as deleting it all together and still no luck.
The file i'm trying to reach is: http://www.elmershardware.co.uk/xtt5ughh.htm
If someone could help point me in the right direction of fixing this I'd be really appreciative
Thanks
G
I think there is nothing to do with .htaccess. It's something related with your apache conf.
In your apache configuration file check if in DirectoryIndex appears
index.htm as a entry, add it if it doesn't appears and restart apache. Then , try again

Configure httpd.conf to add new site on Apache Red Hat Linux

I have linux server (Red Hat Enterprise Linux Server release 5.3 (Tikanga)) with apache installed. It is already used for browsing some documents. Now I would like to add a new Directory (with a html page), so whenever the directory is browsed it can display the html page.
But I am not sure of where all to edit the httpd.conf file
Existing httpd.conf:
When I hit the url "http://servername/eng" it displays list of folders.
Now, I want to add a website to this existing, so when user hit the url "http://servername/builds" it should display a html page in the browser.I have added my "index.html" page in location "/var/www/html/builds/"
For this I added the below code to httpd.conf file
Please let me know what all modifications are required in the conf file
You can do it in a few different ways.
Putting index.html in /build
This requires you to have this setting:
DirectoryIndex index.html
(it should be there by default on most platform.)
Also for this to work, rather than putting new <Directory>, you should put the build/ directory in the directory that holds your http://example.com/ files. For instance:
/var/www/example.com/public_html/eng/
/var/www/example.com/public_html/builds/
/var/www/example.com/public_html/builds/index.html
Storing build/ in folder completely unrelated to example.com, but still be able to reach it via example.com/builds
For this, you need to rewrite the URLs so that example.com/builds redirects the user to the final URL. This is most easily achieved through mod_rewrite. You enable mod_rewrite module in your Apache's configuration, make sure that example.com can have .htaccess files through ensuring proper AllowOverride entry in example.com's <Directory> configuration, create /var/www//example.com/public_html/.htaccess (or similar) file, and fill it RewriteEngine On and RewriteRules you need. More on mod_rewrite in the Internet and in the documentation.
Completely separate virtual server, for example builds.example.com/
In this case, what you're looking for are virtual servers. These are not defined in httpd.conf or configuration itself, but usually have dedicated directory.
For example, to add builds.example.com that works for port 80, you'd need to create following entry:
<VirtualHost *:80>
ServerName builds.example.com
DocumentRoot /var/www/builds.example.com/public_html/
</VirtualHost>
Where to put this? Well, it depends on the platform. For Debian, you put this in a new file in /etc/apache2/sites-available/, e.g. /etc/apache2/sites-available/example.com, and symlink to it in /etc/apache2/sites-available (on Debian, you can do this easily with a2ensite <NAME_OF_FILE>. On your platform this procedure might be different, so look it up ("adding virtual servers on " would be a start). After adding virtual servers, you need to reload your Apache configuration.
Please let me know if this satisfies your question, if not, I'll edit the answer accordingly.

.htaccess redirect to subdirectory on Verio windows server

I've been trying to get a website up an running on my work's servers using Verio windows server 2003 gold and they've been quite useless when it comes to helping me out.
All I'm trying to do is set up a Wordpress installation, which they apparently require to be in a subdirectory. This is done and I have it in domain.com/wp ready to go. At this point they recommend that I use an .htaccess file to redirect to that url, so as they just sent me basically an "About .htaccess" link, that was of no help.
Did some searching, found a couple options like this one:
http://www.site5.com/blog/apache/htaccess/redirect-to-blog/20090427/
and nothing I use seems to work, not even as a straight redirect. Just gives me a "Directory Listing Denied - This Virtual Directory does not allow contents to be listed."
I do want to mention I did enable URL Rewrite for IIS via ISAPI_Rewrite 3 in the control panel.
As I mentioned Verio support is useless and I can't seem to find anything searching that seems to help my situation.
So pretty much what I need is domain.com/wp to rewrite as domain.com so all links centered around it do the same (ie domain.com/about domain.com/contact)
Any help? Thanks
If I understand you correct you need your Wordpress application to be available from the root of your web site instead of /wp/ folder? Then please try following .htaccess:
RewriteEngine on
RewriteRule ^(?!wp/)(.*) /wp/$1 [NC]
By the way I think you could try simply copying /wp/ folder content to the root folder.

Resources