I give up. I have read through dozens of questions on here, even asked my own, I have tried numerous things, I just don't know what to do anymore.
I need to create url's out of the following formats: (NSFW links, be warned)
http://jbthehot.com/#page=1
http://jbthehot.com/home?func=viewphoto&id=2969
http://jbthehot.com/home?page=4
http://jbthehot.com/home?func=viewalbum&aid=75
I must be retarded because I simply do NOT understand htaccess. I try not to ask for all-done answers, but in this case, an actual clear, copy/paste answer for at least one of the above formats would really be helpful.
I repeat, I have tried a lot of things, so I'm obviously doing something wrong, or I'm not understanding the rules and conditions right, so a copy/paste answer that is SURE to work would really help me understand what I'm doing wrong here.
If it helps, the component used here is SIM Gallery, on Joomla and there are a couple of other rewrite rules in effect in the .htaccess , here they are:
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
Thank you for any help
RewriteEngine On
RewriteBase /
RewriteRule ^home/viewphoto/([0-9]+)$ home?func=viewphoto&id=$1 [L]
RewriteRule ^home/viewalbum/([0-9]+)$ home?func=viewalbum&aid=$1 [L]
RewriteRule ^home/page/([0-9]+)$ home?page=$1 [L]
So http://jbthehot.com/home/viewphoto/2969 would show you http://jbthehot.com/home?func=viewphoto&id=2969, etc
Related
I'm a complete novice when it comes to htaccess. I've searched for my exact problem to no avail.. perhaps I did not even know what to search for, haha.
Goodness, the title of this question might not even be appropriate!
Here goes:
I need:
https://www.example.com/1 (the 1 (one) at the end will be inserted by the user. So, it may be https://www.example.com/2057 for example. What ever the number at the end, I need it to go to:
https://www.example.com/folder1/folder2/1 (or what ever number is inserted.)
The closest I've come to is this:
RewriteRule ^/(.*) folder1/folder2/%1/index.php? [R,L]
However, this gives a VERY long example.com/folder1/folder2/folder/1/folder2.....for a LONG time.../1.php
Any help would be greatly appreciated.
This seems to work in may case:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/?(.*) http://www.examplesite.com/folder1/folder2/$1 [R=301,L]
This worked at time of this posting. Hope it helps someone in the future.
RewriteEngine on
RewriteRule ^([0-9]+)((?:A|L)[0-9]R[0-9]+[A-Z]?)$
https://www.mywebsite.com/folder/$2&login=$1 [L]
RewriteRule ^([0-9]+)((?:A|L)[0-9]?)$ https:/www.mywebsite.com/folder/$2&login=$1 [L]
RewriteEngine on
RewriteRule ^([0-9]+)$ https:/www.mywebsite.com/folder/$1 [R=301,L]
Alright I've searched and looked at at least 20 ways to turn site.com/profile?page=username
to just site.com/username
and they DO work, but when I do it and go to the page it starts off loading normal, then completely glitches and continues to glitch and break the page.
I really don't know what to do at this point. I don't know if it's just GoDaddy and I need something specific or what.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^profile/([^/]+) /profile.php?page=$1 [NC]
RewriteRule ^([a-zA-Z0-9_-]+)$ profile.php?page=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ profile.php?page=$1
is the current one i've tried
Solved
I ended up finding someone who posted this, and it worked!
RewriteRule ^([^/]*)/$ /profile.php?page=$1 [L]
In my website there are lot of ugly URLs and now I need to rewrite them to nice user friendly URLs.
These are some of ugly URLs from my website :
http://www.mydomain.com/profiles/tutors/index.php?code=1285&name=Ricky+Pointing
http://www.mydomain.com/profiles/centers/index.php?code=2285&name=City+&+Gills
http://www.mydomain.com/about.php
http://www.mydomain.com/contact.php.... and much more
So I am looking for nice user friendly solution to above ugly URLs, something like this :
http://www.mydomain.com/tutors/Ricky_Pointing.html
http://www.mydomain.com/centers/City_&_Gills.html
http://www.mydomain.com/about.html
http://www.mydomain.com/contact.html
I tried it something similar this in my .htaccess file..
RewriteEngine On
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /profiles/tutors/index.php\?code=([0-9]+)&name=([^&]+)&?([^\ ]+)
RewriteRule ^profiles/tutors/index\.php /%1/%2/?%3 [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9]+)/(.+)/$ /profiles/tutors/index.php?code=$1&name=$2 [L,QSA]
But still no luck.
Can anybody help me to do this?
Thank you.
I think you might be overcomplicating it with RewriteConds and such. You'll probably have rules like this:
RewriteRule ^about\.html$ about.php [L]
RewriteRule ^contact\.html$ contact.php [L]
RewriteRule ^tutors/(.*)\.html$ /profiles/tutors/index.php?name=%1 [L]
RewriteRule ^centers/(.*)\.html$ /profiles/centers/index.php?name=%1 [L]
You'll then have to modify your PHP scripts to look up the appropriate thing with that name without relying on having the code present. It'll also have to deal with the presence of underscores as existed in the original URL.
Ok, so I am wondering what is the correct way to do .htaccess so that a url like this
http://www.mysite.com/?page=spinme
looks like this
http://www.mysite.com/spinme
It still needs to load index.php
but I am not sure how to do it, I know sounds simple.
Also I need it not to effect images or style sheets that are already
http://www.mysite.com/(what ever the folder link)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?page=$1 [L]
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f //not to effect images or style sheets
RewriteCond %{REQUEST_FILENAME} !-d //not to effect directory's
RewriteRule ^(.*)$ index.php?page=$1 [L,QSA]
To make
http://www.mysite.com/?page=spinme
to look like
http://www.mysite.com/spinme
You first of all need to make each output of that URI to be
http://www.mysite.com/spinme
That step is very important (at least for the display, in terms of working, you can skip this step and your site will just work).
If you've managed that, in your .htaccess file, just add a single rule:
RewriteRule ^spinme$ index.php?page=spinme [L]
and you're done.
If you're concerned about Search Engine Optimization (SEO) you should use this URI instead:
http://www.mysite.com/?page=spinme
It will show the search engine that your site has pages and they have a name. That's additional information searchengines process nowadays, comparable to keywords in earlier days.
Hope this is helpful.
I'm pretty new to apache, and I need some help with some .htaccess rewrite rules. Here're the current rules:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/beta/index\.php$
RewriteRule ^(.*)$ /beta/index\.php [R=302,L]
Basically it redirects any requests to mydomain.com\beta\index.php, except if a filename's specified. This works fine for now.
Here's the problem:
I have a subdomain beta.mydomain.com which I don't want these rules to apply to. Any URL on beta.subdomain.com should be treated normally. However, since the .htaccess is at the server root, it's rules are messing with the beta.subdomain.com as well.
I've tried many different combinations of regex, but I can't figure it out. Help!
You need use something like this (to check if your request was related to specific domain/subdomain):
RewriteCond %{HTTP_HOST} ^([^.]+)\.mydomain\.com(:80)?$
20 seconds were missed... But my answer is better ;)
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !/beta/index\.php$
RewriteCond %{HTTP_HOST} !^beta\.subdomain\.com
RewriteRule ^(.*)$ /beta/index\.php [R=302,L]
This ought to do the trick!