stargateatlantis
asked on
Problem with rewrite access
In my .htaccess file I have the following but the problem is when i type mydomain.com/site/info/?id =234
As soon as I type /?id=234 it redirects back to mydomain.com/site. Is there any way to fix this. What do I need to change in my .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/?site/(.*)$ /site/public/$1
</IfModule>
As soon as I type /?id=234 it redirects back to mydomain.com/site. Is there any way to fix this. What do I need to change in my .htaccess file
As your additional post demonstrates, only the URL - not the query string - is tested in RewriteRule. To rewrite or redirect based on the query string, you need a RewriteCond directive.
Please post the specific information required to generate the rule(s) you need:
Please post the specific information required to generate the rule(s) you need:
The URL the user types in
The URL that should be delivered in response
Should the user see the URL they typed, or the URL you are actually delivering?
ASKER
So basically I want the ability to type the following in the URL browser and the user should see what they have typed
http://www.mydomain.com/site/?id=1234
But the following .htaccess needs to be modified
http://www.mydomain.com/site/?id=1234
But the following .htaccess needs to be modified
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/?site/(.*)$ /site/public/$1
</IfModule>
If I put http://www.mydomain.com/site/?id=1234 into my address bar, what page do you want it to go to on your site?
ASKER
No page it should stay on the same page
Then what page do you want redirected to that URL?
ASKER
When the user types http://www.mydomain.com/site/?id=1234 it stays on that page
My Current .htaccess is this
The site files are located under /site/public
Thanks for the help
My Current .htaccess is this
The site files are located under /site/public
Thanks for the help
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/?site/(.*)$ /site/public/$1
</IfModule>
ASKER
I tried the following but it didn't work
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/?site/(.*)$ /site/public/$1
RewriteRule ^([a-z]{2,2})/([a-zA-Z0-9_-]+)$ site/?id=$1
</IfModule>
Let's start again. You have a real, actual page on your site. Let's call it URL-A. The user browses to your site by typing "http://yourdomain.com/URL-B" into their address bar. What I need to know:
What is the actual address for URL-A?
What is the actual address for URL-B?
Will the user see URL-A or URL-B in the address bar?
ASKER
So when typing www.mysite.com/site it will access the following folder /site/public/.
When typing
www.mysite.com/site/subdir/?id=1
It will still access the folder on the server /site/public/.
I don't need the url rewritten to this
www.mysite.com/site/subdir/id/1
I just want it so that when i type any url variable after slash it will not redirect to www.mysite.com/site/
When typing
www.mysite.com/site/subdir/?id=1
It will still access the folder on the server /site/public/.
I don't need the url rewritten to this
www.mysite.com/site/subdir/id/1
I just want it so that when i type any url variable after slash it will not redirect to www.mysite.com/site/
ASKER
I tried the following but no luck
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/?site/(.*)$ /site/public/$1
RewriteRule ^([a-z]{2,2})/([a-zA-Z0-9_-]+)$ /site/?id=$1 [QSA]
</IfModule>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Steve so this is the issue as soon as i type a
http://www.mysite.com/site/dir/?id=1
it redirects to http://www.mysite.com/site/
and there is no files in that directory.
What should happen when the user types in
http://www.mysite.com/site/dir/?id=1
the url shouldn't change but it should read all the files in the public folder that is why i have the following in my .htaccess now
What is throwing it off is the /?id=1 or any variables.
Thanks for all the help guys I know its confusing.
http://www.mysite.com/site/dir/?id=1
it redirects to http://www.mysite.com/site/
and there is no files in that directory.
What should happen when the user types in
http://www.mysite.com/site/dir/?id=1
the url shouldn't change but it should read all the files in the public folder that is why i have the following in my .htaccess now
What is throwing it off is the /?id=1 or any variables.
Thanks for all the help guys I know its confusing.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/?site/(.*)$ /site/public/$1
</IfModule>
So, if I browse to www.mysite.com/site/dir/?id=1, then you want it to actually look for www.mysite.com/site/public/dir/?id=1. Is that correct?
RewriteRule ^/?site/(.*)$ /site/public/$1 [QSA]
ASKER
If i browse to
www.mysite.com/site/dir/?id=1
I want it to stay there
what is happening the site redirects to
www.mysite.com/site/?id=1
which is wrong
Thanks Steve for the help
www.mysite.com/site/dir/?id=1
I want it to stay there
what is happening the site redirects to
www.mysite.com/site/?id=1
which is wrong
Thanks Steve for the help
How do you determine which URLs do *not* redirect to /site/public?
ASKER
Open in new window