url rewriting doesnt work for pages in subdomain - mod-rewrite

I need to change abc.mydomain.com/xyz.php?id3=se
to abc.mydomain.com/xyz/se/ with url rewriting.
Here is my code in .htaccess (placed in abc folder)
Options +FollowSymLinks
RewriteEngine on
RewriteRule /xyz/([0-9a-zA-Z]+) /xyz.php?id3=$1
I'm using a hosted server.
also tried without Options +FollowSymLinks but still doesn't work. appreciate any advice from someone please.

I guess you have to remove the "/" from "/xyz.php?id3=$1".
You are in abc folder '/www/abc', and your .htaccess is in the same folder, so the "/" makes the server thinks that the page xyz.php is in the root folder which is /www and not in /www/abc !
I had the same problem and I solved it this way!
So try this code:
Options +FollowSymLinks
RewriteEngine on
RewriteRule /xyz/([0-9a-zA-Z]+) xyz.php?id3=$1

Add the domainname in your rule:
RewriteRule http://example.com/xyz/([0-9a-zA-Z]+) http://example.com/xyz.php?id3=$1

Related

Laravel 4.2 rewrite URL - remove public

My old domain: domain.com
My laravel project in: domain.com/laravel/public
It's working well, but I don't want see public in URL.
I add new .htaccess file to my root laravel folder (domain.com/laravel/.htaccess) with:
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
When I access to domain.com/laravel, my jQuery path is: domain.com/js/jquery.min.js
When I access to domain.com/laravel/public, my jQuery path is: domain.com/laravel/public/js/jquery.min.js
I don't want move all files in public folder to root folder, because really more files there.
Best regards,
I read more answers in more website, almost their said move all files in public folder to root folder of Laravel application.
It's not good if we have more files there, so, I was try with some way and finally, I just move index.php and .htaccess file to root application.
It's working well, I just change some code when using HTML::script, HTML::css and {{ asset }}
As normal, we using HTML::css('style.css'), I just add public before, like this: HTML::css('public/style.css')
I hope it helpful for someone.
Best regards.
This is my current solution:
<IfModule mod_rewrite.c>
RewriteCond $1 !^(public)
RewriteRule ^(.*)$ /public/$1 [L]
</IfModule>
You have to add a rewrite condition.

Mod Rewrite Sub Folder Structure to GET Variable

How would I write a url such as the following
www.linku.biz/profile/jacktrow
to
www.linku.biz/profile/?us=jacktrow
Being 'jacktrow' can be just letters (a-Z)
What would be the complete code I can place in a .htaccess in the directly of profile?
Much appreciated, mod rewrites and .htaccess are just such a pain!
First, make sure mod_rewrite is enabled.
Then, put this code in your htaccess (in root folder)
RewriteEngine on
RewriteRule ^profile/([a-z]+)$ /profile/index.php?us=$1 [L]

ISAPI Rewrite Syntax Incorrect?

I'm trying to use Helicon Isapi rewrite on IIS 6. Basically all I want to accomplish is redirecting a directory to another site.
I would like to the URL to stay the same.
The URL is http://www.harrisburgu.edu/online-graduate-degrees
http://166.78.104.118/online-graduate-degree
Here is my syntax that dos not seem to work, I've placed the file in the root of my virtual host or should I place it in the folder online-graduate-degrees?
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP:Host} ^harrisburgu\.net$ [NC]
RewriteRule ^online-graduate-degrees$ http:\\166.78.104.118/online-graduate-degree [NC,P,L]
Thanks for any assistance!
Mr.brandt, you're all over internet. And I'm folowing you ))) Let's continue looking at your logs here - http://www.helicontech.com/community/viewtopic.php?t=2277

mod-rewrite: url-rewrite in .htaccess does not work

I want to rewrite URLs from my-custom-url.com/abc/admin/anypage/ to my-custom-url.com/def/admin/anypage/
I have already taken a look to http://httpd.apache.org/docs/2.0/misc/rewriteguide.html, chapter "Moved Document Root"
I opened .htaccess in root directory (which refers to http://www.my-custom-url.com/), looked for <IfModule mod_rewrite.c> and included the following code:
RewriteEngine on
RewriteRule ^/abc/admin/$ /def/admin/ [R]
I tried also:
RewriteRule /abc/admin/ /def/admin/
Both didn't work. What's wrong?
First of all, take shure, that you are allowed to use .htaccess and modRewrite
To take shure:
write some nonsenss in your .htaccess eg asdfasdf as fasdfa
This should exec an Internal Server Error When you get the error, delete the nonsenss .-)
Then try this:
RewriteEngine on
RewriteRule ^test-the-world/$ http://www.google.de [L]
RewriteRule ^abc/admin/$ /def/admin/ [R,L]
Then open the URI's:
http://example.com/test-the-world/ -> when successful you go tho google.de
http://example.com/abc/admin/ ->when successful you go to /def/admin/

htaccess rewrite for clean image url

I'm looking for a re-write for an identicon generator where something like
images/1-2.png
Would be interpretted on the server as
images/index.php?one=1&two=2
But it would still show site.com/images/1-2.png in the address bar.
Assumed there's only one dash (-) in the file name
Doable?
This will do it, put this in your .htaccess file in the root of your application.
RewriteEngine on
RewriteBase /
RewriteRule ^images/(\d)-(\d)\.png images/index.php?one=$1&two=$2 [NC,L]

Resources