apache .conf file 404 error and the wrong file loaded

I’m running a few personal websites off a ubuntu 16.04 VPS server and I’m trying to modify each site so that no “.html” will appear as the suffix to the website and that “www.” will not appear as a prefix. I would like the website to work if someone types in these modifiers to the address as well. So far the removal of the www. and .html works well, but none of my individual pages are now loading. For instance, example.com/projects is a tab on my navigation bar in the example.com index. If I click the tab the address bar shows example.com/projects and a “404 not found” with “The requested URL /projects was not found on this server”. Regardless if I change projects to href=”projects.html” or href=”projects” in the main index.html file, nothing loads and I get a 404. I think there may be something wrong with the way the directory is input into the .conf file. It should be trying to load “projects” not “/projects”

What I have tried:

  • change .html to .html in the rewrite rules. I think the \ is necessary though
  • restart apache after saving each .conf modification
  • read into the apache site for mod_rewrite
  • I have referenced this: https://stackoverflow.com/questions/55079746/mod-rewrite-to-remove-html-from-address-bar-without-changing-links-in-the-html
  • I have not enabled .htaccess because .htacess is disabled by default in ubuntu 16.04. It is also not suggested to use by apache so I am heeding their words.

Here’s my example code:

<VirtualHost *:80>     ServerName example.com     ServerAlias www.example.com     ServerAdmin admin@example.com     DocumentRoot /var/www/example.com      <Directory /var/www/example.com>         Options -Indexes +FollowSymLinks         AllowOverride All     </Directory>      ErrorLog $  {APACHE_LOG_DIR}/example.com-error.log     CustomLog $  {APACHE_LOG_DIR}/example.com-access.log combined     RewriteEngine on     RewriteCond %{SERVER_NAME} =www.example.com [OR]     RewriteCond %{SERVER_NAME} =example.com     RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost>  <VirtualHost *:443>     ServerName example.com     ServerAlias www.example.com     ServerAdmin admin@example.com     DocumentRoot /var/www/example.com      <Directory /var/www/example.com>         Options -Indexes +FollowSymLinks         AllowOverride All     </Directory>      RewriteEngine on      RewriteCond %{THE_REQUEST} \s/+(.*)\.html[\s?/] [NC]     RewriteRule ^  /%1 [R=301,L,NE]     RewriteCond %{REQUEST_FILENAME}   !-f      RewriteCond %{REQUEST_FILENAME}\.html -f     RewriteRule ^(.*)$   /$  1.html [L]      ErrorLog $  {APACHE_LOG_DIR}/example.com-error.log     CustomLog $  {APACHE_LOG_DIR}/example.com-access.log combined     Include /etc/letsencrypt/options-ssl-apache.conf     SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem     SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem </VirtualHost> 

I’m not exactly sure how to resolve this problem. If anyone has any input that would be most excellent!

Thanks a ton for any advice!

For all filenames in beautifulsoup file, return tags are empty

I’m wanting to parse through a large .txt file and pull out bits and pieces of data based on their parent tags. The problem is, for example, the ‘class = “ro” ‘ contains hundreds of different bits of text and numbers, most of which aren’t useful.

import requests from bs4 import BeautifulSoup  data = requests.get('https://www.sec.gov/Archives/edgar/data/320193/0000320193-18-000070.txt')  # load the data soup = BeautifulSoup(data.text, 'html.parser')  # get the data for tr in soup.find_all('tr', {'class':['rou','ro','re','reu']}):     db = [td.text.strip() for td in tr.find_all('td')]     print(db) 

As I said prior, this works to get all those tags, but 95% of the returns are useless. I want to filter based on the filename using a for loop or something that works similarly… “For all files with FILENAME = R2, R3, etc.”… grab all tags with class ‘ro’, ‘rou’, etc. Everything I’ve tried thus far returns empties… can someone assist with this? Thanks in advance!

<DOCUMENT> <TYPE>XML <SEQUENCE>14 **<FILENAME>R2.htm** <------- for everything with this filename <DESCRIPTION>IDEA: XBRL DOCUMENT <TEXT> <html> <head> <title></title> .....removed for brevity </head> <body> .....removed for brevity <td class="text">&#160;<span></span> <------ return this tag </td> .....removed for brevity </tr> 

Two samples files can be found here in their entirety:

(https://www.sec.gov/Archives/edgar/data/1800/0001104659-18-065076.txt) (https://www.sec.gov/Archives/edgar/data/1084869/0001437749-18-020205.txt)

Uploading of backdoor results in the server removing file extensions. Any workaround?

I am totally new within the scene of information security, but find it extremely interesting and thus taking a course at my university, where we have to break into a website/webserver. The website is an image sharing website. The website is badly secured and I am looking for a way to upload my php backdoor created through weevely.

I can without problems upload a php file to the server. The problem is that the server automatically removes the file extensions, which makes it impossible for me to access through weevely (or so I think). Is there anyway to access a backdoor, when the file extensions are missing or is there a workaround?

Apologize for the rookie question!

Thanks How the upload folder looks like

Error: HTML Element Doesn’t Exist in Code-Behind File in Visual Studio

I’m trying to create a control for a calendar element in my Web application. It’s a very basic Web app., and I already have a control for a button element that is working properly. However, the calendar element is not being recognized in the code-behind (C#) file for some reason.

I’ve already ensured that runat = “server” exists in the Calendar element, and that the code-behind file is properly inherited in the ASP.NET file.

protected void Calendar1_SelectionChanged(object sender, EventArgs e) { Label1.Text = Calendar1.SelectedDate.ToLongDateString();}

In the ASP.NET file, I have Calendar ID = “Calendar1” runat = “server” … embedded in asp tags, but it’s still not recognizing Calendar1. I also made sure Calendar1_SelectionChanged(…) exists in Calendar1’s events. Any help would be appreciated.

How to organize file uploads saved to a cloud storage bucket

I’m writing a mobile app that allows users to upload file attachments (images and pdfs), and later download them for offline use. When a file is uploaded, the file itself is stored in a Google Cloud Storage bucket, and metadata for the file is stored to an attachment table in Postgres.

My plan currently is to store them all flat in a single folder in the bucket, such as <MY_BUCKET_NAME>:fileAttachments/<attachment_uuid>. That way, when a client knows that it needs a certain attachment_uuid, it can get a download URL for it easily. I think this is a solid approach, but there are a few slight changes I’m considering and wanted feedback on.

Rather than storing them all flat, like so:

<MY_BUCKET_NAME>:fileAttachments/a447862d-14bb-44d5-8032-5c038e531257

I’m considering storing them nested by uuid prefix, like so:

<MY_BUCKET_NAME>:fileAttachments/a4/a447862d-14bb-44d5-8032-5c038e531257

The only upside I see of storing them this way is that they’re easier to navigate when using the web console (which will rarely ever happen), but is there any other advantage? Or is it just an additional unnecessary complexity?

Also, I’m considering saving them with the file extension in the file name, like so:

<MY_BUCKET_NAME>:fileAttachments/a447862d-14bb-44d5-8032-5c038e531257.png

This also seems a little redundant since the Postgres metadata keeps the MIME type and file name info, and also the Google Cloud Storage has the MIME type as well. When a client downloads the aforementioned PNG but it doesn’t have a file extension, shouldn’t it still know that it’s a PNG by its MIME type? Or would appending this .png be a good idea to “double-confirm” the type of the file?

I’m leaning towards using the first approach, <MY_BUCKET_NAME>:fileAttachments/a447862d-14bb-44d5-8032-5c038e531257, but I wanted to get feedback in case I’m overlooking anything.

How Can I Check the Location of a File (e.g. Cluster or Sector) on the Internal Storage?

I would like to know If I certain file moves on the Flash memory (internal storage), between writes/updates to it.

Is there some way I can get the file’s location on the Flash memory?
(Cluster Number, Sector Number, etc)

I am using Android v8,
and can either install use an App for that,
or use the Command Line, If a relevant command exists in the Linux command-prompt that Android has.