1

This is my rewrite code:

RewriteEngine On
RewriteRule ^index$ index.php [L,QSA]
RewriteRule ^shopName/([^/]+)/(.*)?$ contactus.php?shopName=$1&shopId=$2 [L,QSA]

My results URL is:

http://noblenetwork.net/shopName/Eyepax/5

I need to customize this URL as:

http://noblenetwork.net/Eyepax

I do not want to show the id in the URL. Please help me.

3
  • If shopId is required this is not possible Commented Aug 14, 2013 at 8:31
  • realy? it's ok. If I dont need the shopId, what will be the rewrite rule? Commented Aug 14, 2013 at 8:37
  • if you dont need it, better dont send it...change your url Commented Aug 14, 2013 at 9:04

1 Answer 1

1

Change your .htaccess code to

RewriteEngine On

RewriteRule ^index$ index.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?(.*)$ contactus.php?shopName=$1&shopId=$2 [L,QSA]

If shop id isn't passed contactus.php would receive it as &shopId= blank or null. So, you can use both

http://noblenetwork.net/Eyepax
http://noblenetwork.net/Eyepax/5
Sign up to request clarification or add additional context in comments.

2 Comments

hi Ravi, this is working. but, it made my website very slow. do u have any idea about this issue?
@user2319101, can you test the website performance with rule disabled (just put a # in front of it)? This would help identify if the rule is really causing the problem. If you see marked improvements when the rule is off, please share the Tomcat rewrite logs when the rule is on and the website runs slow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.