Getting rid of old URL parameters from a redirected site

I'm setting up redirects for a domain that had many URL parameters that have no purpose or function anymore. I'd like to consolidate them, and set up redirect rules so that the parameters disappear. So that:

http://www.example.com/the-first-url/?op=auth;method=init

Will redirect to:

http://www.example.com/the-first-url/ And

http://www.example.com/the-second-url/?op=auth;method=init

Will redirect to:

http://www.example.com/the-second-url/

Is there a single rule I can add in the .htaccess file that will see that parameter and remove it, regardless of what comes before?

Ubuntu server (apache) won’t respond to external requests

I'm fairly new to this so I could be missing something totally obvious, but I can't connect to my server using my external IP. Internally everything works like a dream (10.0.0.28/redmine), but when I try to connect using the external IP the requests time out. I forwarded both my ssh port and port 80 as shown below, but that didn't solve the problem. My ports now show as being open with www.portchecktool.com.

SSH works fine internally, but when I issue the command shown here it says connection closed by remote host.

ssh {my external ip} -pxxxx -i /home/millerir/.ssh/id_rsa -l imiller

Similarly when I navigate to {my ip}/redmine or {my ip} or {my_ip}:80 or my ddns service address I get connection reset while trying to connect errors from my browser.

I did check that the server was listening on port 80 and my ssh port as shown below.

[email protected]:/etc/apache2/sites-available$ sudo netstat -tulpn | grep LISTEN
tcp        0      0 0.0.0.0:xxxx            0.0.0.0:*               LISTEN      779/sshd
tcp        0      0 127.0.0.1:57384         0.0.0.0:*               LISTEN      1192/redmine
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      862/mysqld
tcp6       0      0 :::xxxx                 :::*                    LISTEN      779/sshd
tcp6       0      0 :::80                   :::*                    LISTEN      923/apache2

If anyone could help me that would be greatly appreciated. I'm stuck and kind of clueless.

redmine.conf

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        #ServerName www.example.com

        ServerAdmin [email protected]
        #DocumentRoot /var/www/html

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf

        DocumentRoot /var/www
        <Directory /var/www/redmine>
                RailsBaseURI /redmine
                PassengerResolveSymLinksInDocumentRoot on
        </Directory> 
 </VirtualHost>

http.conf

<Listen 80

<IfModule ssl_module>
        Listen 443
</IfModule>

<IfModule mod_gnutls.c>
        Listen 443
</IfModule>

Apache HTTP and HTTPS redirect

I have the following requirement,

  • images, js and css to work both HTTP and HTTPS
  • /reso/test/* to be served with HTTP
  • rest of the /reso/* to be redirect to HTTPS

I've tried following but did not work properly, Please tell me what was wrong

RewriteEngine On
RewriteCond $1 !\.(gif|jpe?g|png|css|js)$ [NC]

RewriteCond %{HTTPS} on 
RewriteRule ^/reso/test/* http://%{HTTP_HOST}%{REQUEST_URI}

RewriteCond %{HTTPS} off
RewriteRule ^/reso/* https://%{HTTP_HOST}%{REQUEST_URI}

Appreciate if you can explain the answer as well !

PHP Slim Framewrok : The requested URL was not found on this server

For one of the projects, i am using Slim Framework http://www.slimframework.com/ to create restful APIs in PHP.

I did a manual install for the framework by copying it in the PHP project folder using instructions at https://github.com/slimphp/Slim.

Later i updated my .htaccess as well.

For my project, I have the following Directory Structure

project\
----slim\
----tests\
----index.php
----.htaccess

For this, the Get call i.e. http://someIp/project/ works for me. It fetches the standard "Welcome to Slim! Congratulations! Your Slim application is running. If this is your first time using Slim, start with this "Hello World" Tutorial." However, post/patch/delete and other get are not working. Not even get for hello. It gives the not found error.

http://someIp/project/hello/:name The requested URL /project/hello/:name was not found on this server.

http://someIp/project/post The requested URL /project/post was not found on this server.

Updated my .htaccess file as :

RewriteEngine On
RewriteBase /project/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

Still it is failing.

When i made changes into the apache config file to allowOverride = all, it failed even for the GET call on index.php. For sure, it is not mapping from .htaccess.

I am still clueless what changes i need to make to .htaccess or any other file to get it working.

I can’t find the Spam script in my server CentOs [on hold]

I'm using centOS 6.6 and I have installed a magento store... everything worked fine until receive a email from gmail telling me that the IP of my host is in his blacklist. I revise the log and I realize that sendmail is sending thousand of SPAM emails, so I search for the internet but I can't find a solution... I used Maldet to find the scripts and yes it found some scripts in my var/www/html folder, I cleaned all but sendmail is still sending Spam. I do not know what to do! I need some help, Im new in this.

Some info: All the SPAM Email are from my IP, Received (from [email protected]) all email are generate for e.g [email protected] the X-PHP-Originating-Script: 48:lib.php (48 is the Apache "user") I can't find this file (lib.php) in all the server...

So Someone can help me in this case?

I'm sorry for my english.

A custom rewrite rule on a PHP micro MVC framework

I am using an MVC micro framework and i have the following .htaccess rules:

Options -MultiViews
Options -Indexes

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]

This rewrites everything to index.php?url=(e.g. user/register/)

In a controller named "profile" i have an action "view" (that takes 2 args) which means that the URL would normally be:

profile/view/arg1/arg2

What i am trying to do is to hava a more friendly url like:

profile/1/profile-name

but when i try the following:

RewriteRule ^profile/([0-9]+)/(.*)/?$ profile/view/$1/$2 [NC,L]

it is not working.

In other words i am only trying to rewrite the original url to remove the "view" action so that anyone could visit that url just by entering the profile id (arg1) and the name (arg2).

How do I prohibit access to one of my folders with .htaccess? [Ubuntu]

I am running a DigitalOcean droplet with Ubuntu 14.04 x64.

In my /var/www/html directory, I have a include/ folder of files I include in PHP files but aren't standalone. I would like to prohibit direct URL access (return 403 errors) to these files, but still make it so that my standalone files can include them.

I have tried creating a .htaccess file inside the include/ folder containing:

<Files *>
    Order Deny,Allow
    Deny From All
    Allow From {my droplet IP address}
</Files>

This is not prohibiting access. Is this the right approach? Is my .htaccess file wrong? Is the IP address I am allowing from wrong?

Thanks.

.htaccess masking domain subfolders

I need a simple .htaccess solution.

I have not been able to come up with one myself that doesn't create a 301 redirect.

I am working on a site at this site.

Obviously this site will only be allowed to be viewed in other countries other than the united states.

What i need in addition to the ip filter and other general access queries, is the abilty to mask the url subfolders.

Meaning i want the site to display even if we are on the /english route or even the blocked-ip route is showing.

I did try searching the other threads to find a simplified answer but could not.

rails 2 debug connection reset by peer error

I have multiple apps running in the same server.

I have this issue with this one application which is rails 2 and ruby 1.8.x which does the following:

  1. The users Upload a spreadsheet with some company information and username though the UI.

  2. Once the file is uploaded it hits a external service to create client certificates based on the information provided.

  3. It then stores the certificate information in the database.

The problem I am having is sometimes the controller just errors out with the following:

"Connection Reset by peer"

Note this is an internal app and will be used by 2 people at the most.

And the error does not seem to happen everytime. It happens every now and then and the size of the file does not seem to be the issue.

Sometimes it goes through without any error for large files and sometimes it fails on small files. Sometimes the same file upload passes the second time I looked at the web service logs and it does not have any errors.

I looked at the web logs and found the following:

4.0.10/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in process_request'/opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-4.0.10/lib/phusion_passenger/request_handler/thread_handler.rb:140:inaccept_and_process_next_request'/opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-4.0.10/lib/phusion_passenger/request_handler/thread_handler.rb:108:in main_loop'/opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-4.0.10/lib/phusion_passenger/request_handler.rb:441:in start_threads'/opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-4.0.10/lib/phusion_passenger/request_handler.rb:435:in `initialize'/opt/ruby-1.9.3/lib/ruby/gems/1.9.1/gems/passenger-4.0.10/lib/phusion_passenger/request_handler.rb:435 Redirected to http://my-url?flash%5Berror%5D=Unable+to+process+uploaded+file.+Please+make+sure+you+provided+a+valid+excel+%28.xls%29+file.+Detailed+error+message%3A+Connection+reset+by+peer

Is there something on the passenger apache config that I might be able to fix and test?

Maybe increase the PassengerMaxPoolSize & PassengerPoolIdleTime?

I dont want to play with the config without understanding it well.