Redirect apache with path to new domain

For example, I have olddomain.com and newdomain.com

I would like to redirect:

  • olddomain.com to newdomain.com,
  • olddomain.com/if-theres-a-path to newdomain.com/backup/if-theres-a-path

I've been trying several config but not working, last one the I tried:

RewriteRule ^/(.*)$ http://newdomain.com/backup/$1 [L,R=301]
RewriteRule ^/$ http://newdomain.com/$1

Git Server Apache https repository not found

I installed a git-server on my Apache-Server. It works as I want. But when I try to make it with ssl I get the following Error:

fatal: repository 'https://[email protected]/git/project1.git/' not found

I only changed the git.conf file. I added the lines with arrow ("-->"). Without these lines the server work over http without problems

--><VirtualHost *:443>
SetEnv GIT_PROJECT_ROOT /var/www/git
SetEnv GIT_HTTP_EXPORT_ALL
ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
RewriteCond %{QUERY_STRING} service=git-receive-pack [OR]
RewriteCond %{REQUEST_URI} /git-receive-pack$
RewriteRule ^/git/ - [E=AUTHREQUIRED:yes]

<LocationMatch "^/git/">
        -->SSLOptions +FakeBasicAuth
        Order Deny,Allow
        Deny from env=AUTHREQUIRED
        AuthType Basic
        AuthName "Git Access"
        AuthBasicProvider file
        AuthUserFile "/usr/local/apache/passwd/passwords"
        Require valid-user
</LocationMatch>
LogLevel debug
ErrorLog /var/www/git/Error.log
CustomLog /var/www/git/Custom.log combined
-->SSLEngine on
-->SSLProtocol all
-->SSLCertificateKeyFile /usr/local/apache/ssl/ca.key
-->SSLCertificateFile /usr/local/apache/ssl/ca.crt
--></VirtualHost>

I can restart apache and I get no errors. I downloaded the ssl certificate. That shouldnt be a problem. I tryed

sudo git update-server-info

But it didnt fix the issue.

Maybe someone got an idea. English isn't my first language so please be patient with my text. Thanks for reading best regards Sam

RoR and Apache2 doesn’t work

I'm trying to setup necessary to make Ruby on Rails works with Apache2 but it doesn't work and I absolutely don't know why. I'm completely noob with RoR (that's precisely why I want to install it).

I've ready many tutorials and try each one. To sum up : I've an Apache2 server with PHP and MySQL running on a Debian server for many years. I've installed: Ruby:

$ ruby -v                                                                                                                                   
ruby 2.3.0preview1 (2015-11-11 trunk 52539) [x86_64-linux]

Rails:

sudo rails -v                                                                                                                             
Rails 4.2.5.1

I also enabled Passenger module on Apache server and put what should be in conf.d/ to enable this module, loading mod_passenger.so

Last, I tried to create a new project with controller to try:

$ sudo rails new test -d mysql
$ sudo generate controller welcome index

I edit routes.rb like that :

get 'welcome/login'
root 'welcome/login'

In apache vhost file I created a vhost to make the url http://test.mydomain.com point to /home/myuser/sd/test (test is the folder created by the previous command).

And I get the list of files but not the defaut RoR index, as if the RoR module is not enabled or just ignore. I don't know where does the problem can be as I have no error message. Do you have any idea?

Thx for help.

Is it possible to simplify this htaccess file?

Is it possible to simplify this htaccess file? (it is for a german website about mathematics) Here comes the content of the htaccess file:

RewriteEngine on
RewriteRule ^testversion/formeln/quadrat-formeln-und-eigenschaften$  testversion/formeln/index.php?id=1 [PT]
RewriteRule ^testversion/formeln/rechteck-formeln-und-eigenschaften$ testversion/formeln/index.php?id=2 [PT]
RewriteRule ^testversion/formeln/raute-formeln-und-eigenschaften$  testversion/formeln/index.php?id=3 [PT]
RewriteRule ^testversion/formeln/deltoid-formeln-und-eigenschaften$  testversion/formeln/index.php?id=4 [PT]
RewriteRule ^testversion/formeln/parallelogramm-formeln-und-eigenschaften$  testversion/formeln/index.php?id=5 [PT]
RewriteRule ^testversion/formeln/trapez-formeln-und-eigenschaften$  testversion/formeln/index.php?id=6 [PT]
RewriteRule ^testversion/formeln/sehnenviereck-formeln-und-eigenschaften$  testversion/formeln/index.php?id=7 [PT]
RewriteRule ^testversion/formeln/gleichseitiges-dreieck-formeln-und-eigenschaften$  testversion/formeln/index.php?id=8 [PT]
RewriteRule ^testversion/formeln/gleichschenkliges-dreieck-formeln-und-eigenschaften$  testversion/formeln/index.php?id=9 [PT]
RewriteRule ^testversion/formeln/rechtwinkliges-dreieck-formeln-und-eigenschaften$  testversion/formeln/index.php?id=10 [PT]
RewriteRule ^testversion/formeln/allgemeines-dreieck-formeln-und-eigenschaften$  testversion/formeln/index.php?id=11 [PT]
RewriteRule ^testversion/formeln/kreis-formeln-und-eigenschaften$  testversion/formeln/index.php?id=12 [PT]
RewriteRule ^testversion/formeln/kreisring-formeln-und-eigenschaften$  testversion/formeln/index.php?id=13 [PT]
RewriteRule ^testversion/formeln/kreissektor-formeln-und-eigenschaften$  testversion/formeln/index.php?id=14 [PT]
RewriteRule ^testversion/formeln/ellipse-formeln-und-eigenschaften$  testversion/formeln/index.php?id=15 [PT]
RewriteRule ^testversion/formeln/regelmäßiges-sechseck-formeln-und-eigenschaften$  testversion/formeln/index.php?id=16 [PT]
RewriteRule ^testversion/formeln/würfel-formeln-und-eigenschaften$  testversion/formeln/index.php?id=17 [PT]
RewriteRule ^testversion/formeln/quader-formeln-und-eigenschaften$  testversion/formeln/index.php?id=18 [PT]
RewriteRule ^testversion/formeln/tetraeder-formeln-und-eigenschaften$  testversion/formeln/index.php?id=19 [PT]
RewriteRule ^testversion/formeln/oktaeder-formeln-und-eigenschaften$  testversion/formeln/index.php?id=20 [PT]
RewriteRule ^testversion/formeln/dodekaeder-formeln-und-eigenschaften$  testversion/formeln/index.php?id=21 [PT]
RewriteRule ^testversion/formeln/ikosaeder-formeln-und-eigenschaften$  testversion/formeln/index.php?id=22 [PT]

Thank you in advance for your tips and suggestions!

.htaccess works like i created a new directory

I have bone.php and bone.css inside public_html in my server. Inside bone.php i have a link tag which calls bone.css <link rel="stylesheet" type="text/css" href="bone.css">. i have created .htaccess file for bone.php file

 RewriteRule ^community/([0-9a-zA-Z]+) bone.php?first=$1 [NC, L]

After i created .htaccess i need to change link tag like <link rel="stylesheet" type="text/css" href="../bone.css">. Which means bone.php thinks its inside a folder, which is not.

If its only way i need change all links inside my website. I hope someone will say there is an another way.Thanks

301 Redirect on many urls, wildcard? [on hold]

I am migrating from Magento to Woocommerce.

Right now, the url permalink for my products is:

domain.com/index.php/productname.html

On woocommerce, it will be:

domain.com/product/productname

I am wondering if someone can help me make a 301 redirect to regex/wildcard all of them? All the previous info I can find is to make redirects per url in the .htaccess. Since I have a lot of products, I hope that someone can help me with a better solution.

Thanks!

ajax and htaccess issue

i using htaccess for change url:

localhost/test/broker.php?id=1

change to

localhost/test/1 

htaccess code:

RewriteRule ^([0-9]+)   broker.php?id=$1    [QSA,L]

in my code also manually add page name to the url for exp

localhost/test/1/iphone

and still page load and working.

now my problem is using ajax in broker.php and if url to be without "iphone" word work correctly but with "iphone" word not working and without response

this is my ajax code:

$.ajax({
    type: "POST",
    url: 'yt.php',
    data: "broker_id=" + $("#broker_id").val() + "&uname=" + $("#uname").val() + "&email=" + $("#email").val() + "&country=" + $("#country").val() + "&rating=" + rating + "&review=" + $("#review").val(),

also i had a lot of changes in htaccess for broker.php and also for yt.php but my problem not solved!

please help me and tell what is wrong?

Build Interrupt when performing Duplicator backup in WordPress

I'm doing some web work for a client, and I want to experiment with their wordpress site on my local server. In order to do this, I'm trying to use the Duplicator plugin so I can just download the backupfiles and deploy them on my localhost.

The projected file size for my backup is well over the recommended (840MB, or 450MB if I exclude a bunch of files I'd rather have), so I've created a php5.ini and made the following settings

max_execution_time=900
mysql.connect_timeout = 900

These are properly reflected when I do a phpinfo()

I still get the same error over and over, so I checked the server error logs, and I see the following:

mod_fcgid: read data timeout in 120 seconds, referer http://mysite/wp-admin/admin.php?page=duplicator&tab=new3
End of script output before headers: admin-ajax.php, referer http://mysite/wp-admin/admin.php?page=duplicator&tab=new3

Is there another setting I need to make somewhere? This is all happening on a godaddy shared hosting account, so I'm hoping it isn't anything I can't access.

Thanks!