SnapOverflow

SnapOverflow Logo SnapOverflow Logo

SnapOverflow Navigation

  • Home
  • Server
  • Ubuntu

Mobile menu

Close
  • Home
  • System Administrators
    • Hot Questions
    • New Questions
    • Tags
  • Ubuntu
    • Hot Questions
    • New Questions
    • Tags
  • Help
Home / server / Questions

Questions[mod-rewrite](server)

Martin Hope
user124130
Asked: 2012-06-10 04:15:10 +0800 CST

How to I test if mod_rewrite is enabled?

  • 20

I'm setting up an environment for wordpress on apache2, on a fresh install of ubuntu 12.04.

In order to get friendly URLS working, I'm trying to set up mod_rewrite. I followed some instructions I found on the net, and used a2enmod.

Now. after restarting apache, I'd like to check if the module is actually loaded.

The command that I've found for getting a list of loaded modules is this:

apache2 -t -D DUMP_MODULES

However, this returns an error:

apache2: bad user name ${APACHE_RUN_USER}

So, how do I actually list all loaded modules, or otherwise check to see if mod_rewrite has been enabled?

apache-2.2 mod-rewrite
  • 9 Answers
  • 71361 Views
Martin Hope
Jiho Kang
Asked: 2011-11-21 18:01:09 +0800 CST

best way to debug nginx rewrite rules in config file?

  • 57

I have a bunch of rewrite rules that I have to port from apache to nginx.

It's a rather painful process because I'm not able to see if my rewrite rules and "if" conditions are working as I want them to.

Apache did have debugging for its rewrite module. Whats can I do for nginx?

linux apache-2.2 lamp nginx mod-rewrite
  • 4 Answers
  • 86628 Views
Martin Hope
Mark McDonald
Asked: 2011-02-06 21:53:18 +0800 CST

Returning "200 OK" in Apache on HTTP OPTIONS requests

  • 17

I'm attempting to implement cross-domain HTTP access control without touching any code.

I've got my Apache(2) server returning the correct Access Control headers with this block:

Header set Access-Control-Allow-Origin "*"                   
Header set Access-Control-Allow-Methods "POST, GET, OPTIONS" 

I now need to prevent Apache from executing my code when the browser sends a HTTP OPTIONS request (it's stored in the REQUEST_METHOD environment variable), returning 200 OK.

How can I configure Apache to respond "200 OK" when the request method is OPTIONS?

I've tried this mod_rewrite block, but the Access Control headers are lost.

RewriteEngine On                  
RewriteCond %{REQUEST_METHOD} OPTIONS 
RewriteRule ^(.*)$ $1 [R=200,L]       
http apache-2.2 security mod-rewrite
  • 3 Answers
  • 56275 Views
Martin Hope
Kyle Brandt
Asked: 2010-12-21 08:59:18 +0800 CST

Redirect, Change URLs or Redirect HTTP to HTTPS in Apache - Everything You Ever Wanted to Know About mod_rewrite Rules but Were Afraid to Ask

  • 281

This is a Canonical Question about Apache's mod_rewrite.

Changing a request URL or redirecting users to a different URL than the one they originally requested is done using mod_rewrite. This includes such things as:

  • Changing HTTP to HTTPS (or the other way around)
  • Changing a request to a page which no longer exist to a new replacement.
  • Modifying a URL format (such as ?id=3433 to /id/3433 )
  • Presenting a different page based on the browser, based on the referrer, based on anything possible under the moon and sun.
  • Anything you want to mess around with URL

Everything You Ever Wanted to Know about Mod_Rewrite Rules but Were Afraid to Ask!

How can I become an expert at writing mod_rewrite rules?

  • What is the fundamental format and structure of mod_rewrite rules?
  • What form/flavor of regular expressions do I need to have a solid grasp of?
  • What are the most common mistakes/pitfalls when writing rewrite rules?
  • What is a good method for testing and verifying mod_rewrite rules?
  • Are there SEO or performance implications of mod_rewrite rules I should be aware of?
  • Are there common situations where mod_rewrite might seem like the right tool for the job but isn't?
  • What are some common examples?

A place to test your rules

The htaccess tester web site is a great place to play around with your rules and test them. It even shows the debug output so you can see what matched and what did not.

apache-2.2 redirect mod-rewrite 301-redirect redirection
  • 5 Answers
  • 111209 Views
Martin Hope
DisgruntledGoat
Asked: 2010-03-09 12:56:25 +0800 CST

Redirect URL within Apache VirtualHost?

  • 70

I have a dedicated server with Apache, on which I've set up some VirtualHosts. I've set up one to handle the www domain as well as the non-www domain.

My VH .conf file for the www:

<VirtualHost *>
  DocumentRoot /var/www/site
  ServerName www.example.com
  <Directory "/var/www/site">
    allow from all
  </Directory>
</VirtualHost>

With this .htaccess:

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

Is there a simple way to redirect the www to the non-www version? Currently I'm sending both versions to the same DocumentRoot and using .htaccess but I'm sure I must be able to do it in the VirtualHost file.

apache-2.2 virtualhost redirect mod-rewrite
  • 4 Answers
  • 270895 Views

Sidebar

Stats

  • Questions 681965
  • Answers 980273
  • Best Answers 280204
  • Users 287326
  • Popular
  • Answers
  • Marko Smith

    Can you pass user/pass for HTTP Basic Authentication in URL parameters?

    • 5 Answers
  • Marko Smith

    Ping a Specific Port

    • 18 Answers
  • Marko Smith

    Check if port is open or closed on a Linux server?

    • 7 Answers
  • Marko Smith

    How to automate SSH login with password?

    • 10 Answers
  • Marko Smith

    How do I tell Git for Windows where to find my private RSA key?

    • 30 Answers
  • Marko Smith

    What's the default superuser username/password for postgres after a new install?

    • 5 Answers
  • Marko Smith

    What port does SFTP use?

    • 6 Answers
  • Marko Smith

    Command line to list users in a Windows Active Directory group?

    • 9 Answers
  • Marko Smith

    What is a Pem file and how does it differ from other OpenSSL Generated Key File Formats?

    • 3 Answers
  • Marko Smith

    How to determine if a bash variable is empty?

    • 15 Answers
  • Martin Hope
    Davie Ping a Specific Port 2009-10-09 01:57:50 +0800 CST
  • Martin Hope
    Smudge Our security auditor is an idiot. How do I give him the information he wants? 2011-07-23 14:44:34 +0800 CST
  • Martin Hope
    kernel Can scp copy directories recursively? 2011-04-29 20:24:45 +0800 CST
  • Martin Hope
    Robert ssh returns "Bad owner or permissions on ~/.ssh/config" 2011-03-30 10:15:48 +0800 CST
  • Martin Hope
    Eonil How to automate SSH login with password? 2011-03-02 03:07:12 +0800 CST
  • Martin Hope
    gunwin How do I deal with a compromised server? 2011-01-03 13:31:27 +0800 CST
  • Martin Hope
    Tom Feiner How can I sort du -h output by size 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich What is a Pem file and how does it differ from other OpenSSL Generated Key File Formats? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent How to determine if a bash variable is empty? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus How do you find what process is holding a file open in Windows? 2009-05-01 16:47:16 +0800 CST

Related Questions

Trending Tags

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • Home
  • Questions
    • Hot Questions
    • New Questions
  • Tags
  • Help

Footer

SnapOverflow

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Help

© 2022 SOF-TR. All Rights Reserve