# [SOLVED] apache-2.2.15 amd64 mod_rewrite does not work

## lucas_knake

Hello

My current box

```
Linux eldor 2.6.34-gentoo-r1 #3 SMP Tue Jul 13 19:51:06 CEST 2010 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor 3800+ AuthenticAMD GNU/Linux

KDE Development Platform: 4.4.4 (KDE 4.4.4)

amd64

```

```
# emerge --info =www-servers/apache-2.2.15

Portage 2.1.8.3 (default/linux/amd64/10.0, gcc-4.4.3, glibc-2.11.2-r0, 2.6.34-gentoo-r1 x86_64)

=================================================================

                        System Settings

=================================================================

System uname: Linux-2.6.34-gentoo-r1-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_3800+-with-gentoo-1.12.13

Timestamp of tree: Tue, 13 Jul 2010 06:15:02 +0000

ccache version 2.4 [enabled]

app-shells/bash:     4.0_p37

dev-java/java-config: 2.1.11

dev-lang/python:     2.6.5-r2, 3.1.2-r3

dev-util/ccache:     2.4-r7

dev-util/cmake:      2.8.1-r2

sys-apps/baselayout: 1.12.13

sys-apps/sandbox:    1.6-r2

sys-devel/autoconf:  2.65

sys-devel/automake:  1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1

sys-devel/binutils:  2.20.1-r1

sys-devel/gcc:       4.4.3-r2

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   2.2.6b

virtual/os-headers:  2.6.30-r1

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA dlj-1.1 AdobeFlash-10.1"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-O2 -march=native -pipe -msse3 -ggdb"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"

CXXFLAGS="-O2 -march=native -pipe -msse3 -ggdb"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests ccache distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms splitdebug strict unmerge-logs unmerge-orphans userfetch"

GENTOO_MIRRORS="http://ftp.vectranet.pl/gentoo http://ftp.spline.inf.fu-berlin.de/mirrors/gentoo"

LDFLAGS="-Wl,-O1"

LINGUAS="pl en"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"

USE="3dnow 3dnowext 7zip X acl acpi aiglx alsa amd64 asf branding bzip2 cairo cli consolekit cracklib crypt css cups curl cxx dbus divix dri exif ffmpeg flac fortran gdbm gmp gnuplot gnutls gpm iconv imagemagick imap imlib jpeg jpeg2k kde lame latex logrotate mmx mmxext mng modules mp3 mudflap multilib mysql ncurses new-login nls nptl nptlonly nsplugin opengl openmp pam pcre perl png pppd python qt3support qt4 rar rdesktop readline reflection samba session smp spl sql sse sse2 sse3 ssl svg symlink sysfs tcpd theora threads tiff truetype unicode vim vim-syntax webkit x264 xcomposite xinerama xml xorg xscreensaver xv xvid zeroconf zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="pl en" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY

=================================================================

                        Package Settings

=================================================================

www-servers/apache-2.2.15 was built with the following:

USE="(multilib) ssl suexec threads -debug -doc -ldap (-selinux) -static" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias -asis -auth_digest -authn_dbd -cern_meta -cgi -cgid -charset_lite -dbd -dumpio -ident -imagemap -log_forensic -proxy -proxy_ajp -proxy_balancer -proxy_connect -proxy_ftp -proxy_http -substitute -version" APACHE2_MPMS="-event -itk -peruser -prefork -worker"                                  

LDFLAGS="-Wl,-O1 -Wl,--no-as-needed"
```

New hard disk, new installation. I did emerge apache 2.2.15 php 5.2.13, add APACHE_OPTS -D PHP5 -D USERDIR, set AllowOverride and Options and...

mod_rewrite does not work at all...

My earlier box was 2.6.30r5, kde 4.3.5, amd64 ~amd64, same apache, only php 5.2.12... Same configuration and everything was working ok.

Example:

.htaccess

```
RewriteEngine On

RewriteRule ^(.*)$ index.php
```

address [url]http://localhost/~luk/WhereDoYouGo/indexk.php[/url]

error_log

```
[Mon Jul 19 10:14:16 2010] [error] [client 127.0.0.1] script '/home/luk/public_html/WhereDoYouGo/indexk.php' not found or unable to stat
```

access_log

```
127.0.0.1 - - [19/Jul/2010:10:14:16 +0200] "GET /~luk/WhereDoYouGo/indexk.php HTTP/1.1" 404 285
```

Correctly apache should open index.php. Am I right?

Is anyone who have same problem, or is it just me?Last edited by lucas_knake on Tue Jul 20, 2010 9:16 pm; edited 1 time in total

----------

## lxg

I don't see too many details about your actual Apache configuration, so it's hard to check.

But there's always one common pitfall: For mod_rewrite to work, You must have FollowSymLinks in the Options line of your vHost configuration.

----------

## lucas_knake

Hi

I found problem. Line 

```
RewriteBase /~luk/WhereDoYouGo
```

 was missing. 

But imo main problem was that the changes I made in .htaccess did not change anything. I need to delete .htaccess file and create new one. For me it looks like this file was magically cached  :Razz:  Or maybe I just need to rest...

Regards

----------

## lxg

Glad it works now. However, if that code is really in your .htaccess, you should get nothing but a HTTP 500 error. You misspelled RewriteBase, and I doubt that there is a directory /~luk.  :Wink: 

Usually the problem is that people don't set the correct Options in the vHost config. Or they have the correct options, but they forget to restart the server.

By the way, .htaccess files are not cached anywhere.

----------

## lucas_knake

Yes it works now.

Thanks for support  :Smile: 

----------

