Jump to content

Combine two rewrite rules


Recommended Posts

We have an entry in .htacess to rewrite if file is not physically present asOptions +FollowSymlinksRewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^([A-Za-z0-9_-]+)$ /folder/index.php?id=$1 [NC]RewriteRule ^([A-Za-z0-9_-]+)/$ /folder/index.php?id=$1 [NC]RewriteRule ^([A-Za-z0-9_-]+)/page([0-9])\.php /folder/index.php?id=$1&page=$2 [NC] Now, the issue is that it needs to be combined with another re-write which we have asOptions +FollowSymlinksRewriteEngine OnRewriteCond %{REQUEST_FILENAME}.php -fRewriteRule (.*) $1\.php [L]RewriteCond %{REQUEST_FILENAME} -f [NC,OR]RewriteCond %{REQUEST_FILENAME} -d [NC]RewriteRule .* - [L]RewriteRule ^([A-Za-z0-9_-]+)$ page.php?page=$1 [NC,QSA]RewriteRule ^([A-Za-z0-9_-]+)/$ page.php?page=$1 [NC,QSA]The first one is only for files with folder, the second one for anything else that is not a physical file. How would that best be achieved? I simply cannot get my head around this... Son

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...