Welcome Guest, Not a member yet? Register   Sign In
Mod_Rewrite Help
#1

Basically, mod_rewrite will remove the index.php, but once it does and I get a URL like mysite.com/user/login I get a "file not found." My best guess is that the actual folder isn't being found since instead of having it in the public folder I have it in root folder and access it like ../system

So, my question is. How would I setup mod_rewrite to point to a root folder vs. one in the public_html folder?

Here's what I have:

<IfModule mod_rewrite.c>
        RewriteEngine On

RewriteBase /
# Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/staging-system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
Reply
#2

(This post was last modified: 05-13-2016, 12:17 AM by PaulD. Edit Reason: Added link to apache.org )

Here is what I use, it works for me, but I am too much of a .htaccess amateur to comment on your .htaccess, but I hope this helps in some way.

Code:
DirectoryIndex index.php

RewriteEngine on
RewriteBase /portal/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)

RewriteRule ^(.*)$ index.php?/$1 [L]

The folder is /portal/ within the public html folder.

Paul.

http://httpd.apache.org/docs/current/mod...ewritebase
Reply
#3

(05-13-2016, 12:14 AM)PaulD Wrote: Here is what I use, it works for me, but I am too much of a .htaccess amateur to comment on your .htaccess, but I hope this helps in some way.

Code:
DirectoryIndex index.php

RewriteEngine on
RewriteBase /portal/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|robots\.txt)

RewriteRule ^(.*)$ index.php?/$1 [L]

The folder is /portal/ within the public html folder.

Paul.

http://httpd.apache.org/docs/current/mod...ewritebase

Thanks, Paul. I figured out the issue last night, finally. All I had to do was add the ? after index.php.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB