Jump to content
Sign in to follow this  

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

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...